FIND YOUR NEXT FEW LINES

Results for “or”

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

2638 snippets foundClear filters
RustNumbers & durations

Round and format a decimal value

Round and format a decimal value in a complete Rust program using the standard library.

Rust✓ Tested
Linux CommandsFinding & selecting files

Run a command safely for each matching file

Linux Commands: Use find -exec with argument placeholders so spaces in filenames remain intact.

Linux Commands✓ Tested
JavaRecords & reliable control flow

Run a task on an executor and close it

Java: Java 21 ExecutorService supports try-with-resources to shut down after submitted work.

Java✓ Tested
C++Ownership & optional values

Run cleanup through a scoped destructor

C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.

C++✓ Tested
JavaScriptPromises & iteration protocols

Run dependent async steps in order

JavaScript: Await one result before using it as the input of the next calculation.

JavaScript✓ Tested
TypeScriptPromises & iteration protocols

Run dependent async steps in order

TypeScript: Await one result before using it as the input of the next calculation.

TypeScript✓ Tested
TypeScriptSafe data handling

Safely read a caught error

Check the error type before accessing its message.

unknown✓ Tested
C#Collections & data structures

Search a sorted array efficiently

C#: Array.BinarySearch requires an array sorted with the same comparison rules.

C#✓ Tested
CArray transformations

Search a sorted array with bsearch

C: The search uses the same ordering comparator as the sorted input.

C✓ Tested
RustVectors & slices

Search a sorted slice

Search a sorted slice in a complete Rust program using the standard library.

Rust✓ Tested
C++Numbers & algorithms

Search a sorted vector

Use binary_search after ensuring C++ values are sorted.

C++✓ Tested
SQLText cleanup & matching

Search for a literal LIKE wildcard

SQL: Declare an escape character so a percent sign in the pattern is literal.

SQL✓ Tested