Results for “first”
Small, practical examples. Search by task or narrow things down below.
Sort the highest quantities first
SQL: Specify descending order and a stable tie breaker.
SQL✓ Tested
Sort the highest quantities first
SQL Server: Specify descending order and a stable tie breaker.
SQL Server✓ Tested
Sort the highest quantities first
Postgres: Specify descending order and a stable tie breaker.
Postgres✓ Tested
Sort the highest quantities first
SQLite: Specify descending order and a stable tie breaker.
SQLite✓ Tested
Stop a search loop at the first match
Bash Scripts: Break exits the current loop as soon as the desired item is found.
Bash Scripts✓ Tested
Style the first and last list items
Style the first and last list items with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Use a last-in first-out stack
C#: Stack is useful for reversible traversal and other nested operations.
C#✓ Tested
Use a last-in first-out stack
C++: Read top before pop because pop does not return the removed value.
C++✓ Tested
Use the first fulfilled promise result
JavaScript: Promise.any ignores individual rejections until one input fulfills.
JavaScript✓ Tested
Use the first fulfilled promise result
TypeScript: Promise.any ignores individual rejections until one input fulfills.
TypeScript✓ Tested
Write a generic first-or-fallback helper
C#: Constrain a generic helper through its input shape and return an explicit caller-supplied fallback.
C#✓ Tested
Write and run a first Bash script
Bash Scripts: Write and run a first Bash script with a small standalone Bash program.
Bash Scripts✓ Tested