Results for “library”
Small, practical examples. Search by task or narrow things down below.
Check whether any selected element matches
jQuery: is returns a Boolean without changing the selection.
jQuery✓ Tested
Check whether bytes contain valid JSON
Check whether bytes contain valid JSON using a complete Go program with explicit sample inputs.
Go✓ Tested
Check whether text contains a phrase
Use a case-sensitive Java substring check.
Java✓ Tested
Choose a branch with if and else
Choose a branch with if and else using a complete Go program with explicit sample inputs.
Go✓ Tested
Choose an action with match
Choose an action with match in a complete Rust program using the standard library.
Rust✓ Tested
Choose between two branches
Python: Use if and else to handle an available or empty stock count.
Python✓ Tested
Choose between two branches
Java: Use if and else to handle an available or empty stock count.
Java✓ Tested
Choose floating-point arithmetic
Choose floating-point arithmetic in a complete Rust program using the standard library.
Rust✓ Tested
Choose floating-point division
Choose floating-point division using a complete Go program with explicit sample inputs.
Go✓ Tested
Clamp a number to a valid interval
Clamp a number to a valid interval in a complete Rust program using the standard library.
Rust✓ Tested
Clamp a numeric value between bounds
Python: Combine min and max for a closed interval when lower is no greater than upper.
Python✓ Tested
Clamp a value to a range
Use C++17 clamp to bound a numeric value.
C++✓ Tested