Questions Concepts
GitHub icon

Default Parameters Pattern

Default Parameters Pattern - language feature

< >
Example from JavaScript, TypeScript:
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
Example from C3:
fn void test(int x = 10) { ... }
Example from Speedie:
function Find (|string| pattern, |int| pos=0, |int|)

Languages with Default Parameters Pattern include JavaScript, C#, TypeScript, Elixir, C3, Speedie

This question asks: Does the language have a way to define default parameters for functions?

Read more about Default Parameters Pattern on the web: 1.

HTML of this page generated by Features.ts

View source

- Build the next great programming language Search Add Language Features Creators Resources About Blog Acknowledgements Queries Stats Sponsor Traffic Traffic Today Day 305 Logout