PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Default Parameters Pattern

Default Parameters Pattern

Default Parameters Pattern is a language feature.

Syntactic sugar for setting values for parameters if not defined.

Languages with Default Parameters Pattern include JavaScript, C#

Example from JavaScript:

function multiply(a, b = 1) { return a * b; }

Example from C#:

public void ExampleMethod(string optionalstr = "default string") {}

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements · Email · GitHub