FIND YOUR NEXT FEW LINES

Results for “or”

Small, practical examples. Search by task or narrow things down below.

2638 snippets foundClear filters
GoGetting Started

Repeat a task with a counted loop

Repeat a task with a counted loop using a complete Go program with explicit sample inputs.

Go✓ Tested
Arduino / CTiming & control

Repeat an action a fixed number of times

Use a counter and delay for a simple finite sequence.

for loop✓ Tested
JavaText validation & formatting

Repeat text a fixed number of times

Java: Use String.repeat with a nonnegative repetition count.

Java✓ Tested
Arduino / CSensor calculations

Represent a decimal quantity with a scaled integer

Arduino / C: Integer hundredths avoid floating-point storage for fixed-precision values.

Arduino / C✓ Tested
JavaRecords & reliable control flow

Represent a finite set of states

Java: Use an enum to prevent arbitrary strings from representing application states.

Java✓ Tested
AngularTemplate-driven forms

Require a minimum text length

Require a minimum text length with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
AngularReactive forms

Reset a nonnullable control to its initial value

Reset a nonnullable control to its initial value with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
jQueryDeferred work & queues

Resolve a deferred result

jQuery: done receives the value supplied to resolve.

jQuery✓ Tested
C#Asynchronous work & URI handling

Resolve a relative URI against a base

C#: Use a base URI ending in a slash when the final path component represents a directory.

C#✓ Tested
GitInspecting the working tree

Restrict a diff to one chosen path

Git: Use the double dash separator to distinguish a filename from revisions or options.

Git✓ Tested
JavaQueues & collection operations

Retrieve the smallest queued value first

Java: PriorityQueue poll removes the smallest value under the natural ordering.

Java✓ Tested
JavaRecords & reliable control flow

Return a value from a switch expression

Java: Use an exhaustive switch expression with a fallback for other input values.

Java✓ Tested