Results for “loop”
Small, practical examples. Search by task or narrow things down below.
Dispatch a command with case
Choose an action from a small set of supported commands.
case✓ Tested
Extract successive regex matches
Java: Use a Matcher loop to find all unsigned integer tokens in Java text.
Java✓ Tested
Hello World: Blink
Arduino / C: Blink the built-in LED slowly and then quickly, repeating both rates in loop().
Arduino / C✓ Tested
Parse a small set of long options
Bash Scripts: Use a loop and case statement to consume a value-bearing long option.
Bash Scripts✓ Tested
Read a file without losing its last line
Handle spaces, backslashes, and a final line without a newline.
read lines✓ Tested
Read one character from serial input
Wait for an incoming byte without blocking the main loop.
Serial.available✓ Tested
Remove collection items that satisfy a condition
Java: Use removeIf on a mutable collection to avoid changing it manually inside a for-each loop.
Java✓ Tested
Repeat until a condition becomes true
Bash Scripts: An until loop continues while its test returns a nonzero status.
Bash Scripts✓ Tested