FIND YOUR NEXT FEW LINES

Results for “variable”

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

84 snippets foundClear filters
Bash ScriptsParameter expansion

Remove a known prefix with a shell pattern

Bash Scripts: The hash expansion removes the shortest matching prefix without changing the original variable.

Bash Scripts✓ Tested
PythonGetting Started

Repeat while a condition holds

Python: Count down while a positive number remains, updating the loop variable on each iteration.

Python✓ Tested
C#Getting Started

Repeat while a condition holds

C#: Count down while a positive number remains, updating the loop variable on each iteration.

C#✓ Tested
JavaGetting Started

Repeat while a condition holds

Java: Count down while a positive number remains, updating the loop variable on each iteration.

Java✓ Tested
JavaScriptGetting Started

Repeat while a condition holds

JavaScript: Count down while a positive number remains, updating the loop variable on each iteration.

JavaScript✓ Tested
TypeScriptGetting Started

Repeat while a condition holds

TypeScript: Count down while a positive number remains, updating the loop variable on each iteration.

TypeScript✓ Tested
C++Getting Started

Repeat while a condition holds

C++: Count down while a positive number remains, updating the loop variable on each iteration.

C++✓ Tested
CGetting Started

Repeat while a condition holds

C: Count down while a positive number remains, updating the loop variable on each iteration.

C✓ Tested
Bash ScriptsVariables & text

Replace every occurrence in a string

Substitute text directly with Bash parameter expansion.

replace✓ Tested
TypeScriptSafe data handling

Safely read a caught error

Check the error type before accessing its message.

unknown✓ Tested
Bash ScriptsProcesses & environment

Set an environment value for one child command

Bash Scripts: A command-prefix assignment is visible to that command without overwriting the shell’s current variable.

Bash Scripts✓ Tested
Bash ScriptsVariables & text

Split a line into named fields

Read a simple delimiter-separated line into variables.

read✓ Tested