Function
Use functions to modularize shared logic such as data extraction and generation.
Definition
Use the func
keyword to define either single or multi-line functions. Any valid expression can be used on the right-hand side of the ->
symbol.
Empty Arguments
If your function does not take any arguments you can drop the parentheses as well.
Default Arguments
You can make your arguments optional by passing default values. However, if you add a default value you must also add default values for all subsequent arguments.
Last updated