FIND YOUR NEXT FEW LINES

Results for “while”

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

162 snippets foundClear filters
TypeScriptGetting Started

Explain a calculation with a comment

TypeScript: Keep the code executable while documenting why a fixed input is used.

TypeScript✓ Tested
C++Getting Started

Explain a calculation with a comment

C++: Keep the code executable while documenting why a fixed input is used.

C++✓ Tested
CGetting Started

Explain a calculation with a comment

C: Keep the code executable while documenting why a fixed input is used.

C✓ Tested
CSSVisual treatment & accessibility

Fit an entire image inside a differently shaped box

CSS: Contain preserves the image aspect ratio while keeping all of it visible inside the specified content box.

CSS✓ Tested
Bash ScriptsFunctions & arguments

Give a function an optional argument

Let callers omit a value while keeping nounset enabled.

optional argument✓ Tested
jQueryEvents

Handle a form locally

Prevent default form navigation while displaying input with jQuery.

jQuery✓ Tested
CSSResponsive conditions & sizing

Hide interface controls in print layout

CSS: A print media query can retain article content while removing interactive controls.

CSS✓ Tested
Arduino / CSensor calculations

Ignore small movements around a center value

Arduino / C: Values inside the deadband become zero while others keep their direction.

Arduino / C✓ Tested
HTMLAccessible structure

Keep a decorative icon out of a button’s name

HTML: aria-hidden excludes a decorative character while leaving the visible action text as the accessible name.

HTML✓ Tested
Bash ScriptsProcesses & environment

Keep loop state by avoiding a pipeline subshell

Bash Scripts: Redirect input into a while loop so updates to a counter remain in the current shell.

Bash Scripts✓ Tested
GitInspecting the working tree

List newly added staged files only

Git: Filter the cached diff by added status while leaving modified files out.

Git✓ Tested
Bash ScriptsLoops & decisions

Loop over an array safely

Preserve spaces in array elements while iterating.

array✓ Tested