FIND YOUR NEXT FEW LINES

Results for “return”

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

139 snippets foundClear filters
GoGetting Started

Call a function with a return value

Call a function with a return value using a complete Go program with explicit sample inputs.

Go✓ Tested
RustErrors & optional values

Chain operations that may return None

Chain operations that may return None in a complete Rust program using the standard library.

Rust✓ Tested
Bash ScriptsText parsing & arithmetic

Remove a trailing carriage return from a line

Bash Scripts: Use an ANSI-C quoted carriage return as the suffix pattern.

Bash Scripts✓ Tested
PythonMappings & sets

Remove and return a dictionary entry

Python: Use pop with a default when a missing entry is an expected condition.

Python✓ Tested
Linux CommandsTransforming text

Remove carriage-return characters

Linux Commands: Use tr -d to remove CR characters from Windows-style line endings.

Linux Commands✓ Tested
PowerShellFunctions & parameter validation

Return a collection as one pipeline object

PowerShell: The unary comma prevents the returned array from being enumerated at this boundary.

PowerShell✓ Tested
GoErrors & validation

Return a descriptive validation error

Return a descriptive validation error using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonStructured data & serialization

Return a small immutable named record

Python: Use NamedTuple when callers need both tuple behavior and named fields.

Python✓ Tested
CStructures & function interfaces

Return a status separately from a calculated result

C: An output pointer lets a function return success or failure independently of its numeric result.

C✓ Tested
HTMLNative disclosure & dialogs

Return a value from a dialog form

HTML: A form with method dialog closes its containing dialog without a network submission.

HTML✓ Tested
RustGetting Started

Return a value from a loop

Return a value from a loop in a complete Rust program using the standard library.

Rust✓ Tested
JavaRecords & reliable control flow

Return a value from a switch expression

Java: Use an exhaustive switch expression with a fallback for other input values.

Java✓ Tested