FIND YOUR NEXT FEW LINES

Results for “function”

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

124 snippets foundClear filters
Bash ScriptsDiagnostics & defensive scripting

Check whether a function has been defined

Bash Scripts: declare -F tests a function name without executing it.

Bash Scripts✓ Tested
AngularSignals & state

Choose an equality function for signal values

Choose an equality function for signal values with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
ReactComponents & props

Customize a renderer through a function prop

Customize a renderer through a function prop with a small React component and explicit browser behavior.

React✓ Tested
PowerShellGetting Started

Define a function with a parameter

PowerShell: Define a function with a parameter using PowerShell 7.

PowerShell✓ Tested
PowerShellFunctions & control

Define a function with a typed parameter

Accept a name and return a greeting.

function✓ Tested
Bash ScriptsGetting Started

Define and call a shell function

Bash Scripts: Define and call a shell function with a small standalone Bash program.

Bash Scripts✓ Tested
Arduino / CArrays & embedded state

Dispatch a command through function pointers

Arduino / C: A small function table can map validated command indices to actions.

Arduino / C✓ Tested
PowerShellFunctions & parameter validation

Enforce a numeric range at a function boundary

PowerShell: ValidateRange performs argument validation before work begins.

PowerShell✓ Tested
RustTesting & reusable patterns

Exercise a function with a table of inputs

Exercise a function with a table of inputs in a complete Rust program using the standard library.

Rust✓ Tested
Bash ScriptsFunctions & arguments

Give a function an optional argument

Let callers omit a value while keeping nounset enabled.

optional argument✓ Tested
Bash ScriptsFunction scope & composition

Give a function its own positional parameters

Bash Scripts: A function receives its call arguments without replacing the caller’s positional parameters.

Bash Scripts✓ Tested
Bash ScriptsFunction scope & composition

Keep a function variable local

Bash Scripts: Local prevents an ordinary function assignment from replacing a caller variable.

Bash Scripts✓ Tested