FIND YOUR NEXT FEW LINES

Results for “library”

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

653 snippets foundClear filters
PythonGetting Started

Store a value in a named variable

Python: Give a value a descriptive name and print it.

Python✓ Tested
JavaGetting Started

Store a value in a named variable

Java: Give a value a descriptive name and print it.

Java✓ Tested
jQueryForm serialization & state

Store an object associated with an element

jQuery: data retains JavaScript values without serializing them into HTML attributes.

jQuery✓ Tested
RustFunctions & data types

Store data in an enum variant

Store data in an enum variant in a complete Rust program using the standard library.

Rust✓ Tested
RustNumbers & durations

Subtract durations without underflow

Subtract durations without underflow in a complete Rust program using the standard library.

Rust✓ Tested
CArrays

Sum array values

Iterate over a fixed C array using a size-derived element count.

C✓ Tested
JavaNumbers & dates

Sum integer values

Reduce a Java integer stream to its sum.

Java✓ Tested
C++Numbers & algorithms

Sum vector values

Use std::accumulate with a wide initial value.

C++✓ Tested
CNumbers & memory

Swap two integers

Use a temporary value to swap C integers without arithmetic overflow.

C✓ Tested
PythonIteration & sequences

Take a limited number of iterator values

Python: Use islice to consume only the requested prefix of a potentially unbounded iterator.

Python✓ Tested
JavaStream transformations

Take a page from a stream

Java: Use skip and limit with a known stable input order.

Java✓ Tested
JavaQueues & collection operations

Take an immutable list snapshot

Java: List.copyOf protects the snapshot from later changes to the source list.

Java✓ Tested