FIND YOUR NEXT FEW LINES

Results for “du”

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

410 snippets foundClear filters
Arduino / CSerial communication

Read one character from serial input

Wait for an incoming byte without blocking the main loop.

Serial.available✓ Tested
TypeScriptGetting Started

Read the beginning of a text value

TypeScript: Extract or display the first three ASCII characters from a known nonempty string.

TypeScript✓ Tested
TypeScriptArray traversal & selection

Read the final array item with a negative index

TypeScript: at supports negative positions counted from the end.

TypeScript✓ Tested
TypeScriptGetting Started

Read the first collection element

TypeScript: Access index zero only after establishing that the collection is nonempty.

TypeScript✓ Tested
TypeScriptPromises & iteration protocols

Recover from an expected promise rejection

TypeScript: Return a fallback from catch so later handlers receive an ordinary resolved value.

TypeScript✓ Tested
TypeScriptObject behavior & collections

Remove a Map entry and detect whether it existed

TypeScript: Map.delete returns true only when an entry was present.

TypeScript✓ Tested
TypeScriptRegular expressions & URL encoding

Reorder captured text in a replacement

TypeScript: Use numbered replacement groups to rearrange a known two-part name.

TypeScript✓ Tested
TypeScriptGetting Started

Repeat a fixed number of times

TypeScript: Use a counted loop to print three numbered steps.

TypeScript✓ Tested
TypeScriptText handling & Unicode

Repeat a string a fixed number of times

TypeScript: String.repeat requires a nonnegative finite repetition count.

TypeScript✓ 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
TypeScriptGetting Started

Repeat while a condition holds

TypeScript: Count down while a positive number remains, updating the loop variable on each iteration.

TypeScript✓ Tested
Bash ScriptsFiles & reliability

Replace a text file with an atomic rename

Prepare new content beside the target before renaming it into place.

atomic write✓ Tested