FIND YOUR NEXT FEW LINES

Results for “when”

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

230 snippets foundClear filters
PythonIteration & sequences

Flatten one level of nested lists

Python: Use a nested comprehension when each input item is itself an iterable.

Python✓ Tested
PostgresDates & series

Generate a sequence of numbers

Create rows without a stored table.

generate_series✓ Tested
Linux CommandsDates & process utilities

Generate a stepped sequence

Linux Commands: Use seq when a command pipeline needs a numeric sequence.

Linux Commands✓ Tested
HTMLAccessible structure

Give a section an accessible region name

HTML: A section becomes a named landmark when its heading is referenced with aria-labelledby.

HTML✓ Tested
CSSGrid placement

Give implicit grid rows a minimum height

CSS: Minmax allows an implicit row to grow when its content requires more room.

CSS✓ Tested
JavaStream transformations

Group strings by their length

Java: Choose a TreeMap supplier when group keys must have deterministic order.

Java✓ Tested
C++Numeric parsing & calculations

Handle a failed string-to-integer conversion

C++: stoi throws invalid_argument when no conversion can be performed.

C++✓ Tested
Bash ScriptsProcesses & environment

Handle a nonzero background-job exit

Bash Scripts: Wait reports a child’s exit code; put it in a conditional when failure is expected.

Bash Scripts✓ Tested
PythonFunctions & error handling

Handle an expected child-process failure

Python: Catch CalledProcessError when check=True reports a nonzero exit status.

Python✓ Tested
CSSInteraction selectors

Highlight a group containing keyboard focus

CSS: Focus-within matches a parent when any descendant has focus.

CSS✓ Tested
SQLSubqueries & ranked selection

Include missing values in a not-equal filter

SQL: Ordinary inequality does not include NULL; explicitly include it when that is the intended rule.

SQL✓ Tested
SQL ServerSubqueries & ranked selection

Include missing values in a not-equal filter

SQL Server: Ordinary inequality does not include NULL; explicitly include it when that is the intended rule.

SQL Server✓ Tested