def (function)
Defines your own command.
Syntax
def name(params) { ... return ... }Description
Defined with def. return returns the result; the last expression is also automatically returned (return is optional).
Example
Loading editor…
Expected output
25
When to use?
Preventing code repetition, breaking the program into parts.