FIND YOUR NEXT FEW LINES

Results for “return”

Small, practical examples. Search by task or narrow things down below.

139 snippets foundClear filters
TypeScriptPromises & iteration protocols

Recover from an expected promise rejection

TypeScript: Return a fallback from catch so later handlers receive an ordinary resolved value.

TypeScript✓ Tested
JavaScriptObject behavior & collections

Remove a Map entry and detect whether it existed

JavaScript: Map.delete returns true only when an entry was present.

JavaScript✓ Tested
TypeScriptObject behavior & collections

Remove a Map entry and detect whether it existed

TypeScript: Map.delete returns true only when an entry was present.

TypeScript✓ Tested
CStrings

Remove a trailing line ending

Use strcspn to terminate a C string at its first newline or carriage return.

C✓ Tested
C#Collections & data structures

Remove matching items from a mutable list

C#: List.RemoveAll returns how many items it removed.

C#✓ Tested
CFile positioning & lifecycle

Remove one known scratch file

C: Check remove’s return value instead of assuming deletion succeeded.

C✓ Tested
CFile positioning & lifecycle

Rename a known file

C: The standard rename function reports failure through its return value.

C✓ Tested
Bash ScriptsArguments & decisions

Repeat until a condition becomes true

Bash Scripts: An until loop continues while its test returns a nonzero status.

Bash Scripts✓ Tested
JavaScriptArray restructuring

Replace an array segment in place

JavaScript: splice returns removed items and inserts replacements at the chosen position.

JavaScript✓ Tested
TypeScriptArray restructuring

Replace an array segment in place

TypeScript: splice returns removed items and inserts replacements at the chosen position.

TypeScript✓ Tested
SQLExpressions & aggregates

Replace NULL in a result

Choose a fallback for a missing value.

COALESCE✓ Tested
Arduino / CGetting Started

Reuse an LED action with a function

Arduino / C: Put a short LED sequence in a named function and call it twice.

Arduino / C✓ Tested