Although historically user functions came the Tinderbox much later than action code operators, both use the same syntax:
- Operator or function name. Names are case-sensitive.
- User function names are set by the user by defining the function.
- Trailing parentheses containing argument(s)
- arguments are always comma-delimited. Whitespace before after the commas is ignored by the code parser.
- where there are no arguments or all arguments are optional and not being used, the parentheses may be omitted, e.g.
.sort()
vs..sort
. If in doubt, e.g if new to action code, use the empty parentheses. If unsure if parts of the syntax may safely be omitted, do not guess—use the full syntax. - operators may have optional arguments. Optional arguments are indicated in the main operator listing.
- non-optional arguments must have a value, even if only an empty/default value, e.g.
"
".- all user function arguments are always mandatory.
- some operators, and user functions also use a curly-bracket enclosed code block.
Examples
An operator, here the '[ ]' indicate that one of the arguments is optional:
stamp([scope, ]stampName)
if(condition){actions}[else{actions}]
A user function (following aTbRef general naming conventions):
myFunction(iArg1,iArg2){ }
In the last example, as a user-defined panel, all arguments must be populated even if only with an empty value, thus:
$SomeResult = myFunction("hello",24){ }
Correct
$SomeResult = myFunction("",24){ }
Correct
WRONG$SomeResult = myFunction(,24){ }