Tinderbox v11 Icon

Parentheses: arguments for action code operators and user functions

Although historically user functions came the Tinderbox much later than action code operators, both use the same syntax:

Examples

A simple query term:

inside("Projects") 

or basic operator use:

$MyNumber = sin(45) 

Parentheses may be omitted is no arguments, so either:

$MyString = "uncle".capitalize(); 

or

$MyString = "uncle".capitalize; 

But some operators , e.g. return, never allow trailing parentheses (per-operator documentation explains this). So if $SomeNumber is '4', then in a function:

return (2*$SomeNumber); 

returns '8', but

return 2*$SomeNumber); 

returns nothing. In the latter case, the action code parser assumes the execution order parentheses are arguments—invalid for return—and no value is returned.

The syntax for a conditional operation with branching outcomes (depending whether the condition evaluates true or (else) false:

if(condition){actions}[else{actions}] 

In aTbRef documentation presence of '[ ]' indicate that one or more of the of the arguments is optional:

stamp([scope, ]stampName) 

thus implying both these usages are valid:

stamp("Do Stuff");  
stamp("SomeNote","Do Stuff");  

In most cases, optional arguments come at the end of the argument list. In a few case both argument and parentheses may be optional if there are no arguments and all arguments are optional. Thus:

$MyNewList = $MyList.sort;  
$MyNewList = $MyList.sort();  
$MyNewList = $MyList.sort($SomeString);  

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
$SomeResult = myFunction(,24){ } WRONG