FIND YOUR NEXT FEW LINES

Results for “optional argument”

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

99 snippets foundClear filters
TypeScriptTypes & functions

Give an optional property a default

Handle missing object fields with nullish coalescing.

optional✓ Tested
AngularServices & dependency injection

Handle an optional dependency

Handle an optional dependency with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
RustGetting Started

Handle an optional value

Handle an optional value in a complete Rust program using the standard library.

Rust✓ Tested
RustErrors & optional values

Keep an optional value only when valid

Keep an optional value only when valid in a complete Rust program using the standard library.

Rust✓ 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
HTMLText semantics

Offer an optional break inside a long label

HTML: Wbr supplies a potential line-break opportunity without inserting a visible hyphen.

HTML✓ 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
Docker / ComposeCompose applications

Put an optional service behind a profile

Keep a utility service separate from a normal Compose startup.

Compose✓ Tested