Results for “Records & reliable control flow”
Small, practical examples. Search by task or narrow things down below.
Split a line into named fields
Read a simple delimiter-separated line into variables.
read✓ Tested
Start a command with a minimal environment
Linux Commands: Use env -i with an explicit PATH for a controlled child environment.
Linux Commands✓ Tested
Start an existing container and attach to its output
Docker / Compose: create records the command; start with attach runs that existing container.
Docker / Compose✓ Tested
Style a card based on a selected descendant
CSS: Has matches the parent when its relative selector finds a checked control inside it.
CSS✓ Tested
Style content associated with a checked option
CSS: The adjacent-sibling selector connects a checked control with its following label text.
CSS✓ Tested
Submit a readonly value while preventing edits
HTML: Readonly controls remain in form data, unlike disabled controls.
HTML✓ Tested
Sum typed values with reduce
Accumulate numeric array elements.
reduce✓ Tested
Swap two integers
Use a temporary value to swap C integers without arithmetic overflow.
C✓ Tested
Transform each item in a collection
Build a result array with a foreach expression.
foreach✓ Tested
Truncate a single line
Combine CSS overflow and ellipsis for a constrained single line.
CSS✓ Tested
Type a dictionary with Record
Limit a lookup table to a known set of keys.
Record✓ Tested