FIND YOUR NEXT FEW LINES

Results for “argument”

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

54 snippets foundClear filters
GoFunctions & types

Accept a variable number of arguments

Accept a variable number of arguments using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonFunctions & error handling

Avoid a shared mutable default argument

Python: Create a fresh list inside the function when the optional argument is omitted.

Python✓ Tested
Docker / ComposeDockerfile patterns

Combine a stable entrypoint with default arguments

Docker / Compose: CMD supplies default arguments to an exec-form ENTRYPOINT.

Docker / Compose✓ Tested
Bash ScriptsArguments & decisions

Consume positional arguments one at a time

Bash Scripts: Check the argument count before accessing the first parameter with nounset enabled.

Bash Scripts✓ Tested
Bash ScriptsArguments & decisions

Forward all arguments without changing their boundaries

Bash Scripts: Quoted at-sign preserves empty arguments and embedded spaces.

Bash Scripts✓ Tested
Bash ScriptsFunctions & arguments

Give a function an optional argument

Let callers omit a value while keeping nounset enabled.

optional argument✓ Tested
Docker / ComposeDockerfile patterns

Keep exec-form arguments literal

Docker / Compose: JSON exec form does not expand shell environment variables.

Docker / Compose✓ Tested
Linux CommandsGetting Started

Keep spaces inside one argument

Linux Commands: Keep spaces inside one argument using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested
PowerShellFunctions & parameter validation

Pass a block of behavior as an argument

PowerShell: Invoke a scriptblock with the call operator and an explicit input value.

PowerShell✓ Tested
C++Tasks & synchronization

Pass an argument into a worker thread

C++: Thread arguments are copied by default; std::ref explicitly passes a reference.

C++✓ Tested
PythonFunctions & error handling

Preconfigure some function arguments

Python: Use partial to produce a callable with selected arguments already bound.

Python✓ Tested
Linux CommandsGetting Started

Print separate arguments safely

Linux Commands: Print separate arguments safely using GNU/Linux commands in an empty practice directory.

Linux Commands✓ Tested