Results for “or”
Small, practical examples. Search by task or narrow things down below.
Round and format a decimal value
Round and format a decimal value in a complete Rust program using the standard library.
Rust✓ Tested
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
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
Run cleanup through a scoped destructor
C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.
C++✓ Tested
Run dependent async steps in order
JavaScript: Await one result before using it as the input of the next calculation.
JavaScript✓ Tested
Run dependent async steps in order
TypeScript: Await one result before using it as the input of the next calculation.
TypeScript✓ Tested
Safely read a caught error
Check the error type before accessing its message.
unknown✓ Tested
Search a sorted array efficiently
C#: Array.BinarySearch requires an array sorted with the same comparison rules.
C#✓ Tested
Search a sorted array with bsearch
C: The search uses the same ordering comparator as the sorted input.
C✓ Tested
Search a sorted slice
Search a sorted slice in a complete Rust program using the standard library.
Rust✓ Tested
Search a sorted vector
Use binary_search after ensuring C++ values are sorted.
C++✓ Tested
Search for a literal LIKE wildcard
SQL: Declare an escape character so a percent sign in the pattern is literal.
SQL✓ Tested