Results for “argument”
Small, practical examples. Search by task or narrow things down below.
Accept a variable number of arguments
Accept a variable number of arguments using a complete Go program with explicit sample inputs.
Go✓ Tested
Avoid a shared mutable default argument
Python: Create a fresh list inside the function when the optional argument is omitted.
Python✓ Tested
Combine a stable entrypoint with default arguments
Docker / Compose: CMD supplies default arguments to an exec-form ENTRYPOINT.
Docker / Compose✓ Tested
Consume positional arguments one at a time
Bash Scripts: Check the argument count before accessing the first parameter with nounset enabled.
Bash Scripts✓ Tested
Forward all arguments without changing their boundaries
Bash Scripts: Quoted at-sign preserves empty arguments and embedded spaces.
Bash Scripts✓ Tested
Give a function an optional argument
Let callers omit a value while keeping nounset enabled.
optional argument✓ Tested
Keep exec-form arguments literal
Docker / Compose: JSON exec form does not expand shell environment variables.
Docker / Compose✓ Tested
Keep spaces inside one argument
Linux Commands: Keep spaces inside one argument using GNU/Linux commands in an empty practice directory.
Linux Commands✓ Tested
Pass a block of behavior as an argument
PowerShell: Invoke a scriptblock with the call operator and an explicit input value.
PowerShell✓ Tested
Pass an argument into a worker thread
C++: Thread arguments are copied by default; std::ref explicitly passes a reference.
C++✓ Tested
Preconfigure some function arguments
Python: Use partial to produce a callable with selected arguments already bound.
Python✓ Tested
Print separate arguments safely
Linux Commands: Print separate arguments safely using GNU/Linux commands in an empty practice directory.
Linux Commands✓ Tested