I have since made one small change.
If you add a " ; " to end LOOP inside the BLOCKSTART EQU
it would allow you to name your BLOCK if you so chose.
> *
> EQU BLOCKSTART LIT "LOOP ; "
> EQU BLOCKEND LIT "EXIT ; REPEAT"
> *
> BLOCKSTART LABELNAME:
> CODE
> CODE
> IF () THEN EXIT
> CODE
> CODE
> BLOCKEND
> *
In thinking this through, putting the label after the "LOOP" command
would cause problems if you used a GOTO to jump to that block
since the LOOP would be bypassed, and when it hit the EXIT most
likely would give an error condition (EXIT used outside of LOOP)
So the avoid giving an error condition it would need to add the ;
to the beginning of the LOOP command like:
> *
> EQU BLOCKSTART LIT "; LOOP "
> EQU BLOCKEND LIT "EXIT ; REPEAT"
> *
> LABEL: BLOCKSTART
> CODE
> CODE
> IF () THEN EXIT
> CODE
> CODE
> BLOCKEND
> *
But, after testing the first case to see what kind of error would be
triggered, I found none was triggered....it worked (as expected also).
So....By using the format: (";" before and after the LOOP)
> *
> EQU BLOCKSTART LIT "; LOOP ; "
> EQU BLOCKEND LIT "EXIT ; REPEAT"
> *
You could use either
BLOCKSTART LABEL:
or
LABEL: BLOCKSTART
But apparently, both would work without causing errors, which surprised me.
I would have thought that jumping into that block after the loop statement
would have caused an error condition when an exit was hit.
Of course if your inside the block, you wouldn't need to GO LABEL: you
could always just use CONTINUE to jump back to the top of the block.
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users