Command |
EXIT |
|
|
Description |
Command EXIT() to exit functions or loops. |
|
|
Syntax/Parameters |
EXIT(Name)
> EXIT();
Exit current loop/function.
> EXIT(name);
Exit nested loops/functions up to and including loop/function with name. |
|
|
Example |
> loop(lp1,FOREVER){ calc(x,y,z,"+"); if(x=5?[exit(lp1);]); } // exit loop when x=5
> loop(lp2,FOREVER){ calc(x,y,z,"+"); if(x=5?[exit(lp2);]); } // exit loop when x=5 (as above)
> 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. |
|
|
Update Information |
Version |
Title |
Date |
Details |
49.58 |
EXIT |
07 Sep 15 |
|
* EXIT now allowed from within a priority interrupt
|
|
49.55 |
EXIT() Command from Nested Functions/Loops |
13 Mar 14 |
|
* The EXIT() command was returning a system error when exiting through nested functions and/or loops. * This is now fixed.
Test Code: (Outputs "@+<[][][][][]><[][][][][]><[*@")
SETUP(RS2){set="1152ND";encode=sr;}
VAR(a,0,U8); VAR(b,0,U8);
FUNC(fncA) { LOAD(a,0); LOAD(b,10); LOAD(RS2,"+"); LOOP(lp1,4) { LOAD(RS2,"<"); LOOP(lp2,5) { LOAD(RS2,"["); IF(a=b?[LOAD(RS2,"*");EXIT(fncA);]); CALC(a,"++"); LOAD(RS2,"]"); } LOAD(RS2,">"); } LOAD(RS2,"+"); }
FUNC(fncB) { LOAD(RS2,"@"); RUN(fncA); LOAD(RS2,"@"); }
RUN(fncB);
|
|
49.55 |
EXIT() Command with Priority INTs |
13 Mar 14 |
|
The EXIT() command is now supported within priority interrupts.
Test Code: (Outputs: "@+<[][][][][]><[][][][][]><[*@@+<[][][][][]><[][][][][]><[*@@+<[][][][][]><[][][][][]><[*@" )
SETUP(RS2){set="1152ND";encode=sr;}
VAR(a,0,U8); VAR(b,0,U8);
FUNC(fncA) { LOAD(a,0); LOAD(b,10); LOAD(RS2,"+"); LOOP(lp1,4) { LOAD(RS2,"<"); LOOP(lp2,5) { LOAD(RS2,"["); IF(a=b?[LOAD(RS2,"*");EXIT(fncA);]); CALC(a,"++"); LOAD(RS2,"]"); } LOAD(RS2,">"); } LOAD(RS2,"+"); }
FUNC(fncB) { LOAD(RS2,"@"); RUN(fncA); LOAD(RS2,"@"); }
INT(intTmr0,TIMER0,fncB,5); LOAD(TIMER0,1000,3);
|
|
49.50 |
Commands on Same Line Being Processed After an EXIT() |
15 Jan 14 |
|
A problem has been found and fixed whereby a command appearing on the same line after an EXIT() is being processed when the EXIT condition is true.
... IF( x==1 ? [ EXIT( Lp1 ); ] ); LOAD( RS2, "@" ); ...
In the above, the LOAD( RS2, "@" ); command was being executed when the IF() test was true and the exit condition set. This is now fixed.
|
|
49.32 |
EXIT() - Corrected EXIT() operation when multiple commands exist on same line. |
14 Feb 13 |
|
* Corrected EXIT() operation when multiple commands exist on same line.
|
|
47.24 |
Exit() - end loops and functions - Exit command added to exit loops or functions |
31 Oct 11 |
|
Exit command added to exit loops or functions > exit(); // exit current loop/function > exit(name); // exit nested loops/functions up to and including loop/function with name * Examples: > loop(lp1,FOREVER){ calc(x,y,z,"+"); if(x=5?[exit(lp1);]); } // exit loop when x=5 > loop(lp2,FOREVER){ calc(x,y,z,"+"); if(x=5?[exit(lp2);]); } // exit loop when x=5 (as above) > 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.
|
|
|
|