FIND YOUR NEXT FEW LINES

Results for “optional argument”

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

99 snippets foundClear filters
Bash ScriptsFunctions & arguments

Give a function an optional argument

Let callers omit a value while keeping nounset enabled.

optional argument✓ 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
SQL ServerDates & text

Find the final day of a month

Use EOMONTH without manually calculating month length.

EOMONTH✓ Tested
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
SQLSchema design & transactions

Add an optional field to an existing table

SQL: A nullable column permits existing rows to remain valid while data is filled later.

SQL✓ Tested
SQL ServerSchema design & transactions

Add an optional field to an existing table

SQL Server: A nullable column permits existing rows to remain valid while data is filled later.

SQL Server✓ Tested
PostgresSchema design & transactions

Add an optional field to an existing table

Postgres: A nullable column permits existing rows to remain valid while data is filled later.

Postgres✓ Tested
SQLiteSchema design & transactions

Add an optional field to an existing table

SQLite: A nullable column permits existing rows to remain valid while data is filled later.

SQLite✓ 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
Docker / ComposeLimits & process security

Drop all optional Linux capabilities

Docker / Compose: The effective capability mask becomes zero after cap-drop ALL.

Docker / Compose✓ 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