FIND YOUR NEXT FEW LINES

Results for “Array traversal & selection”

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

228 snippets foundClear filters
TypeScriptTypes & functions

Return the first item with a generic function

Preserve the element type while allowing empty arrays.

generics✓ Tested
JavaScriptArray restructuring

Reverse a copy while preserving the original

JavaScript: Copy before reverse because reverse mutates the array it receives.

JavaScript✓ Tested
TypeScriptArray restructuring

Reverse a copy while preserving the original

TypeScript: Copy before reverse because reverse mutates the array it receives.

TypeScript✓ Tested
PowerShellArray operations

Reverse a copy while preserving the source

PowerShell: Clone the array before using Array.Reverse because Reverse mutates its argument.

PowerShell✓ Tested
PowerShellArray operations

Select elements by an index range

PowerShell: An index range selects the requested array positions in order.

PowerShell✓ Tested
SQLSubqueries & ranked selection

Sort preferred rows ahead of other rows

SQL: A CASE ordering key expresses business priority before a stable secondary sort.

SQL✓ Tested
SQL ServerSubqueries & ranked selection

Sort preferred rows ahead of other rows

SQL Server: A CASE ordering key expresses business priority before a stable secondary sort.

SQL Server✓ Tested
PostgresSubqueries & ranked selection

Sort preferred rows ahead of other rows

Postgres: A CASE ordering key expresses business priority before a stable secondary sort.

Postgres✓ Tested
SQLiteSubqueries & ranked selection

Sort preferred rows ahead of other rows

SQLite: A CASE ordering key expresses business priority before a stable secondary sort.

SQLite✓ Tested
CDynamic memory & ownership

Store a variable-length payload after a structure header

C: A flexible array member lets one allocation hold metadata and trailing bytes.

C✓ Tested
Arduino / CArrays & embedded state

Store samples in a fixed-size ring buffer

Arduino / C: The write position wraps while the storage size stays constant.

Arduino / C✓ Tested
TypeScriptCollections & records

Sum typed values with reduce

Accumulate numeric array elements.

reduce✓ Tested