PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Default Parameters Pattern

Default Parameters Pattern

Default Parameters Pattern is a feature.

Syntactic sugar for setting values for parameters if not defined.


Languages with Default Parameters Pattern include JavaScript, C#, Elixir

Example from JavaScript:
function multiply(a, b = 1) { return a * b; }
Example from C#:
public void ExampleMethod(string optionalstr = "default string") {}
Example from Elixir:
def multiply(a, b \\ 1) do a * b end
case-sensitivity-feature.html 路 default-parameters-feature.html 路 destructuring-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 29 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com