StructureA TBScript file consists of one or more subroutines. All scripts must define one subroutine called MAIN. Execution starts at this subroutine. Any subroutine can return a value using the RETURN keyword.
This example defines two subroutines, main and double. Double accepts an argument and returns that value times two. Main passes 5 to double and prints the result.
Subroutines are called by specifying the name of the subroutine followed by parentheses. If the subroutine takes arguments, they can be specified between the parentheses separated by commas. Subroutine calls may be included in expressions or assigned to a variable, or even used as arguments to other subroutines.
|