Default

Default[f]

gives the default value for arguments of the function f obtained with a _. pattern object.

Default[f,i]

gives the default value to use when _. appears as the i^(th) argument of f.

Default[f,i,n]

gives the default value for the i^(th) argument out of a total of n arguments.

Default[f,]=val

defines default values for arguments of f.

Details

  • _. represents an optional argument to a function, with a default value specified by Default.
  • The necessary values for Default[f] must always be defined before _. is used as an argument of f.
  • Values defined for Default[f] are stored in DefaultValues[f].

Examples

Basic Examples  (1)

Define 0 to be the default argument for a function f:

_. represents an argument that can be omitted:

If the second argument is omitted, the default value of 0 is used instead:

If both arguments are omitted, both are taken to have the default value 0:

Wolfram Research (1988), Default, Wolfram Language function, https://reference.wolfram.com/language/ref/Default.html.

Text

Wolfram Research (1988), Default, Wolfram Language function, https://reference.wolfram.com/language/ref/Default.html.

BibTeX

@misc{reference.wolfram_2020_default, author="Wolfram Research", title="{Default}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Default.html}", note=[Accessed: 19-January-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_default, organization={Wolfram Research}, title={Default}, year={1988}, url={https://reference.wolfram.com/language/ref/Default.html}, note=[Accessed: 19-January-2021 ]}

CMS

Wolfram Language. 1988. "Default." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Default.html.

APA

Wolfram Language. (1988). Default. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Default.html