FIND YOUR NEXT FEW LINES

Results for “library”

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

653 snippets foundClear filters
GoGetting Started

Calculate a subtotal

Calculate a subtotal using a complete Go program with explicit sample inputs.

Go✓ Tested
RustGetting Started

Calculate an order subtotal

Calculate an order subtotal in a complete Rust program using the standard library.

Rust✓ Tested
JavaPrecise numeric calculations

Calculate beyond the long integer range

Java: Use BigInteger when a fixed-width primitive type would overflow.

Java✓ Tested
PythonIteration & sequences

Calculate cumulative totals

Python: Use accumulate to retain the running sum after each input.

Python✓ Tested
JavaStream transformations

Calculate several numeric stream statistics

Java: Use summaryStatistics to calculate count, sum, minimum, maximum, and average in one pass.

Java✓ Tested
PythonNumbers & calculations

Calculate the number of required pages

Python: Use integer arithmetic to round a nonnegative count up to a positive page size.

Python✓ Tested
PythonNumbers & calculations

Calculate with exact rational values

Python: Use Fraction for exact ratios rather than binary floating-point approximations.

Python✓ Tested
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
RustGetting Started

Call a typed function

Call a typed function in a complete Rust program using the standard library.

Rust✓ Tested
jQueryHTTP requests

Cancel a pending request

jQuery: abort rejects the jqXHR with the abort status.

jQuery✓ Tested
PythonFunctions & error handling

Capture a successful child-process result

Python: Run an argument list without a shell and check the return code.

Python✓ Tested
RustFunctions & data types

Capture a surrounding value in a closure

Capture a surrounding value in a closure in a complete Rust program using the standard library.

Rust✓ Tested