Results for “empty”
Small, practical examples. Search by task or narrow things down below.
Update several classifications in one statement
Postgres: A CASE expression computes the new value for each row covered by the update predicate.
Postgres✓ Tested
Use a counted Bash loop
Bash Scripts: Use a counted Bash loop with a small standalone Bash program.
Bash Scripts✓ Tested
Use a default value for an unset variable
Supply a fallback without changing the original variable.
parameter expansion✓ Tested
Use a fallback for an unset variable
Bash Scripts: Use a fallback for an unset variable with a small standalone Bash program.
Bash Scripts✓ Tested
Use a function’s exit status as a boolean result
Bash Scripts: Return zero for success and test the function directly in a conditional.
Bash Scripts✓ Tested
Use a recursive function for a bounded calculation
Bash Scripts: A recursive factorial demonstrates local variables and a clear base case.
Bash Scripts✓ Tested
Use a session-scoped temporary table
Store intermediate rows in a local # table.
temporary table✓ Tested
Use a small table variable
Declare rows for a short batch.
table variable✓ Tested
Validate a simple C-style ASCII identifier
C: Check the first character separately from subsequent characters and reject empty input.
C✓ Tested
Validate a structured text identifier
HTML: The pattern attribute matches the entire nonempty input; required handles the empty case.
HTML✓ Tested
Validate the number of positional arguments
Bash Scripts: Use the argument count to enforce a simple command-line contract.
Bash Scripts✓ Tested
Visit associative-array keys in a stable order
Bash Scripts: Associative arrays have no defined iteration order, so sort their keys explicitly.
Bash Scripts✓ Tested