Functions - Jamiras/RATools GitHub Wiki

A function is a reusable piece of code that may have slightly different behavior controlled by parameters that are passed to the function.

A function may return anything that can be assigned to a variable (numerical or string constants, or an expression to be evaluated later)

  • function name(parameters) { code }

This shorthand defines a function that just returns the specified expression:

  • function name(parameters) => expression

Functions are called by using the function name in an expression. Parameters may be passed by index or key.

  • variable = name(parameter1, parameter2)
  • variable = name(p1 = parameter1, p2 = parameter2)