Results for “block”
Small, practical examples. Search by task or narrow things down below.
Perform cleanup even after an exception
C#: A finally block runs after a handled failure as well as after success.
C#✓ Tested
Position a badge relative to its container
CSS: A positioned ancestor establishes the containing block for an absolutely positioned child.
CSS✓ Tested
Read one character from serial input
Wait for an incoming byte without blocking the main loop.
Serial.available✓ Tested
Repeat an action a fixed number of times
Use a counter and delay for a simple finite sequence.
for loop✓ Tested
Run cleanup after a handled exception
Java: A finally block executes whether the protected operation succeeds or fails.
Java✓ Tested
Set explicit grid row heights
CSS: Grid-template-rows controls each declared row’s block-axis track size.
CSS✓ Tested
Trim and discard blank lines
JavaScript: Split a text block, trim each line, and keep nonempty values.
JavaScript✓ Tested
Trim and discard blank lines
TypeScript: Split a text block, trim each line, and keep nonempty values.
TypeScript✓ Tested
Wait for a container to exit
Docker / Compose: wait blocks until the container stops and prints its exit code.
Docker / Compose✓ Tested