Default Parameters
Understand the implementation of default parameters.
We'll cover the following...
Default parameters
When we define a named function, we can give a default value to any of its parameters by using the syntax param \\ value
. When we call a function that’s defined with default parameters, Elixir compares the number of arguments we’re passing with the number of required parameters for the function.
-
If we’re passing fewer arguments than the number of required parameters, then there’s ...