Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

KRL allows the parameters of functions and user-defined actions to have default values. If the function or action is called without a parameter, that parameter gets its defaults value. Furthermore, arguments can be passed to functions and user-defined actions using named arguments. Arguments are evaluated left to right on execution, so default values for parameters can depend on the values of the parameters to their left. The default value is given by any valid KRL expression. 

Here is an example of the function foo() with two arguments, bar and baz. You can see that each has been given a default value:

...

The same syntax is used in user-defined action with the same effect on parameter values

Default values are optional. A parameter without a default value is considered to be required and will be undefined if no value is passed to the parameter