FIND YOUR NEXT FEW LINES

Results for “items”

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

59 snippets foundClear filters
Bash ScriptsArray operations

Join array items with a one-character separator

Bash Scripts: A local IFS controls the separator used by the quoted star expansion.

Bash Scripts✓ Tested
PythonMappings & sets

Keep only the most recent items

Python: Use a bounded deque to discard the oldest item as new values arrive.

Python✓ Tested
JavaScriptArray restructuring

Map items to multiple output values

JavaScript: flatMap combines mapping and a one-level flattening operation.

JavaScript✓ Tested
TypeScriptArray restructuring

Map items to multiple output values

TypeScript: flatMap combines mapping and a one-level flattening operation.

TypeScript✓ Tested
PythonIteration & sequences

Number items while iterating

Python: Use enumerate to attach a one-based position without maintaining a separate counter.

Python✓ Tested
RustIterators & transformations

Number items while iterating

Number items while iterating in a complete Rust program using the standard library.

Rust✓ Tested
JavaScriptArray traversal & selection

Pair corresponding array items by position

JavaScript: Validate equal lengths before zipping when missing counterparts would be an error.

JavaScript✓ Tested
TypeScriptArray traversal & selection

Pair corresponding array items by position

TypeScript: Validate equal lengths before zipping when missing counterparts would be an error.

TypeScript✓ Tested
PythonIteration & sequences

Pair corresponding list items

Python: Zip two equally sized sequences into pairs; strict mode rejects mismatched lengths on Python 3.10 or later.

Python✓ Tested
Bash ScriptsArray operations

Prepend items while preserving existing array values

Bash Scripts: Construct a new array with the new values before the quoted original expansion.

Bash Scripts✓ Tested
C#Collections & data structures

Process items by numeric priority

C#: PriorityQueue removes the item with the smallest priority value first.

C#✓ Tested
CSSFlexbox alignment

Push flex items to opposite ends

CSS: Space-between distributes free main-axis space between items.

CSS✓ Tested