FIND YOUR NEXT FEW LINES

The snippet library.

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

3000 snippets foundClear filters
PostgresRows & writes

Return an inserted row

Read generated data directly from INSERT.

RETURNING✓ Tested
C#Types & reliable control flow

Return multiple named values from a method

C#: Named value tuples give lightweight field names without a separate class.

C#✓ Tested
Bash ScriptsFunctions & arguments

Return text from a shell function

Capture a function’s output with command substitution.

function✓ Tested
TypeScriptTypes & functions

Return the first item with a generic function

Preserve the element type while allowing empty arrays.

generics✓ Tested
GitGetting Started

Return to the original branch

Git: Return to the original branch inside the disposable repository created by the input setup.

Git✓ Tested
jQueryTraversal & selection

Return to the previous collection in a chain

jQuery: end restores the selection before the last traversal operation.

jQuery✓ Tested
GitBranches & ancestry

Return to the previously checked-out branch

Git: The dash shorthand selects the previous branch in the checkout history.

Git✓ Tested
GoGetting Started

Return two values from a function

Return two values from a function using a complete Go program with explicit sample inputs.

Go✓ Tested
TypeScriptUtilities & async

Return typed data from an async function

Await a Promise and handle failures explicitly.

async✓ Tested
SQLReporting & grouped calculations

Return zero for a sum over no rows

SQL: SUM produces NULL for an empty input; COALESCE supplies the desired reporting default.

SQL✓ Tested
SQL ServerReporting & grouped calculations

Return zero for a sum over no rows

SQL Server: SUM produces NULL for an empty input; COALESCE supplies the desired reporting default.

SQL Server✓ Tested
PostgresReporting & grouped calculations

Return zero for a sum over no rows

Postgres: SUM produces NULL for an empty input; COALESCE supplies the desired reporting default.

Postgres✓ Tested