Results for “if”
Small, practical examples. Search by task or narrow things down below.
Capture configuration by value in a callable
C++: A value capture retains the value from lambda creation even if the original variable changes later.
C++✓ Tested
Catch a T-SQL error
Handle an expected conversion error in TRY/CATCH.
TRY CATCH✓ Tested
Center a fixed-size absolute child with auto margins
CSS: An all-zero inset plus auto margins distributes the available space around the child.
CSS✓ Tested
Center a small item in a grid cell
CSS: Place-items sets both block-axis and inline-axis item alignment.
CSS✓ Tested
Change a control’s appearance on hover
CSS: Hover applies while a pointing device is positioned over the element.
CSS✓ Tested
Change visual order without changing DOM order
CSS: Order changes flex painting positions while keyboard and reading order still follow the document.
CSS✓ Tested
Check a string prefix using ordinal comparison
PowerShell: Supply an explicit comparison rule for protocol identifiers.
PowerShell✓ Tested
Check for an installed command
Bash Scripts: command -v checks command resolution without assuming a specific installation path.
Bash Scripts✓ Tested
Check JSONB containment
Test whether an object contains a key-value pair.
jsonb✓ Tested
Check the integrity of a gzip stream
Linux Commands: Use gzip -t to verify a compressed file without extracting it.
Linux Commands✓ Tested
Check whether a range is already sorted
C++: is_sorted reports ordering without modifying the input.
C++✓ Tested
Check whether text is valid JSON
Reject malformed input before processing it.
json_valid✓ Tested