liveBook · Manning

Optional function argument

An optional function argument is an input corresponding to a parameter that a caller is not required to supply because omission is permitted by the function's interface.

How 4 Manning books explain it

The Well-Grounded Rubyist, Fourth Edition

An optional parameter is a method parameter whose value can be omitted because a default value is specified.

How it is used
Makes Ruby method calls flexible when callers need not supply every positional or keyword value.
How deep it goes
Works through defaults, starred arrays, mixed-parameter binding, and invalid ordering; treats keyword arguments separately.
Examples
Compares method calls that use defaults, override them, fill catch-all arrays, or fail for too few arguments.
What you can do after
Build it from scratch using valid Ruby signatures with optional positional or keyword parameters, and predict argument assignments.

Read how The Well-Grounded Rubyist, Fourth Edition explains optional function argument →

Essential TypeScript 5, Third Edition

An optional parameter is a function parameter that may be omitted by the caller and is denoted with a question mark in TypeScript.

How it is used
Allows callers to omit an argument when a function can operate without its value.
How deep it goes
Explains declaration syntax, required-parameter ordering, omitted values, and the need for a fallback; does not explore compiler internals.
Examples
Uses a tax calculation called with one or two arguments, plus a rejected call with three.
What you can do after
Apply it in TypeScript functions to permit omitted arguments while handling the resulting `undefined` value.

Read how Essential TypeScript 5, Third Edition explains optional function argument →

ASP.NET Core in Action, 3e

An optional parameter is a handler or method parameter that may receive no corresponding input and instead accept a null or default value.

How it is used
Handles missing route, query, or body input without preventing a minimal API handler from running.
How deep it goes
Explains nullable syntax and runtime null behavior, while treating default parameter values as a separate feature.
Examples
Demonstrates /stock/{id?} with int?, a nullable Product body, and contrasting required-parameter failure behavior.
What you can do after
Apply optional arguments via ASP.NET Core minimal APIs to accept missing values and handle null explicitly.

Read how ASP.NET Core in Action, 3e explains optional function argument →

Pro Angular 16

An optional parameter is a function parameter that may be omitted when the function is called.

How it is used
Allows callers to omit selected arguments, especially when constructing product models whose properties may come from HTML forms.
How deep it goes
Defines the `?` syntax, omitted-value behavior, inferred `undefined`, and distinction from a required `string | undefined` parameter.
Examples
Uses a string-printing function with a fallback and Product constructors with omitted model fields.
What you can do after
Apply optional parameters to let calls omit arguments or create partially populated Product objects.

Read how Pro Angular 16 explains optional function argument →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.