Command
|
FUNC
|
Description
|
Create a function called by commands which returns to the
next command on completion. Functions can call other functions and
themselves. No storing or passing of variables occurs as these are all
global even if created in a function.
Maximum 28 nested loops or functions - v49.32.
Maximum Function Size increased: 8192 ASCII characters - v49.32.
|
Syntax/Parameters
|
FUNC(Name) {}
|
Options |
You can exit a function by using the EXIT command EXIT(Name) - end functions - v47.24
> EXIT(name); // exit nested loops/functions up to and including loop/function with name
|
Example
|
> FUNC(fn1) { if(x=5?[EXIT(fn1);]); ...... } // exits function when x=5 without
running rest of code
> FUNC(fn2) { LOOP(lp3,100){ LOAD(RS2,"*"); if(quit=1?[EXIT(fn2);;]);
// sends
100 *'s through RS2 unless quit is set to 1, then loop and the function are
exited (A screen refresh occurs before the exit)
Note, if the name provided in the EXIT(name); command does not exist in the
current function/loop nesting, then all loops
and functions are exited up to the top level. It is not possible to exit the
page loop in this way.
Restriction: If processing a function called from a KEY() command then further key presses will be ignored. Each touch key press function must be processed to completion before another can be processed. Please refer to the project example 'keyboard' for the technique to process keys.
|
|