Results for “return”
Small, practical examples. Search by task or narrow things down below.
Count words using a Map
Update a keyed counter without losing its value type.
Map✓ Tested
Create a reusable one-to-many lookup
C#: ToLookup groups values by key and returns an empty sequence for an unknown key.
C#✓ Tested
Define a function with a typed parameter
Accept a name and return a greeting.
function✓ Tested
Delete a known temporary file if present
Java: deleteIfExists returns whether a file was removed and still reports other I/O errors.
Java✓ Tested
Detect truncated formatted output
Arduino / C: snprintf returns the length it would have written, excluding the null terminator.
Arduino / C✓ Tested
Dismiss a modal with the Escape key
HTML: Native modal dialogs provide keyboard dismissal and return focus to their invoker.
HTML✓ Tested
Display a fallback for missing data
SQL: Return a supplied label when a column contains NULL.
SQL✓ Tested
Display a fallback for missing data
SQL Server: Return a supplied label when a column contains NULL.
SQL Server✓ Tested
Display a fallback for missing data
Postgres: Return a supplied label when a column contains NULL.
Postgres✓ Tested
Display a fallback for missing data
SQLite: Return a supplied label when a column contains NULL.
SQLite✓ Tested
Display a number with a fixed decimal width
JavaScript: toFixed returns a formatted string rather than a numeric value.
JavaScript✓ Tested
Display a number with a fixed decimal width
TypeScript: toFixed returns a formatted string rather than a numeric value.
TypeScript✓ Tested