Results for “when”
Small, practical examples. Search by task or narrow things down below.
Read the current branch name
Git: show-current returns an empty string when HEAD is detached.
Git✓ Tested
Refuse to overwrite an existing file with redirection
Bash Scripts: Noclobber makes a plain greater-than redirection fail when the target already exists.
Bash Scripts✓ Tested
Reject an unsupported settings version
Arduino / C: A version byte lets firmware fall back when stored settings use another format.
Arduino / C✓ Tested
Remove a known prefix safely
Python: Use removeprefix instead of lstrip when removing a literal prefix rather than a set of characters.
Python✓ Tested
Remove a Map entry and detect whether it existed
JavaScript: Map.delete returns true only when an entry was present.
JavaScript✓ Tested
Remove a Map entry and detect whether it existed
TypeScript: Map.delete returns true only when an entry was present.
TypeScript✓ Tested
Remove and return a dictionary entry
Python: Use pop with a default when a missing entry is an expected condition.
Python✓ Tested
Remove dependent rows with a declared cascade
SQL: ON DELETE CASCADE removes children when their referenced parent is deleted.
SQL✓ Tested
Remove dependent rows with a declared cascade
SQL Server: ON DELETE CASCADE removes children when their referenced parent is deleted.
SQL Server✓ Tested
Remove dependent rows with a declared cascade
Postgres: ON DELETE CASCADE removes children when their referenced parent is deleted.
Postgres✓ Tested
Remove dependent rows with a declared cascade
SQLite: ON DELETE CASCADE removes children when their referenced parent is deleted.
SQLite✓ Tested
Remove duplicate result values
SQL: Use DISTINCT when repeated category values are not useful.
SQL✓ Tested