FIND YOUR NEXT FEW LINES

Results for “first lines”

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

185 snippets foundClear filters
C++Containers & compound values

Build a minimum-priority queue

C++: Supply greater as the comparator because priority_queue defaults to the largest value first.

C++✓ Tested
CNumeric parsing & arithmetic

Calculate a page count without an overflowing addition

C: Divide first and add one only when a nonzero remainder remains.

C✓ Tested
C++Sequence algorithms

Calculate changes between successive readings

C++: adjacent_difference keeps the first value and then writes each difference from its predecessor.

C++✓ Tested
JavaScriptArray restructuring

Calculate differences between adjacent readings

JavaScript: Slice off the first value and compare each remaining value with its predecessor.

JavaScript✓ Tested
TypeScriptArray restructuring

Calculate differences between adjacent readings

TypeScript: Slice off the first value and compare each remaining value with its predecessor.

TypeScript✓ Tested
C++Numeric parsing & calculations

Check an upper integer bound before adding

C++: For these nonnegative values, compare against the maximum minus the addend first.

C++✓ Tested
JavaScriptArray traversal & selection

Check whether every item matches

JavaScript: every stops at the first failed predicate and returns true for an empty array.

JavaScript✓ Tested
TypeScriptArray traversal & selection

Check whether every item matches

TypeScript: every stops at the first failed predicate and returns true for an empty array.

TypeScript✓ Tested
Bash ScriptsArguments & decisions

Choose among several numeric ranges

Bash Scripts: An if-elif chain evaluates branches in order and executes the first match.

Bash Scripts✓ Tested
Arduino / CSerial communication

Collect a serial line in a fixed buffer

Read a short command without dynamic String allocation.

serial line✓ Tested
SQLSchema design & transactions

Commit multiple related changes together

SQL: The first transaction prepares the fixtures. The second commits both updates as one unit.

SQL✓ Tested
SQL ServerSchema design & transactions

Commit multiple related changes together

SQL Server: The first transaction prepares the fixtures. The second commits both updates as one unit.

SQL Server✓ Tested