83Plus:Basic:While
Synopsis
Token Size: 1 byte
Syntax:
- While condition
- command
- End
The while command is used to execute a command or series of commands when a variable shares a given relationship with another variable or a value. A While command will continue to execute everything before the next End until the given condition is no longer met.
Comments
Use of a Goto statement within an While statement will cause an increase in memory allocation, leading to program slowdowns and eventually a MEMORY error. For example, the following code will eventually cause an error:
Lbl 0 While X=1 X+1->X Disp X Goto 0 End
If you must use a Goto within an While statement, it is possible to trick the 83+ into thinking the block ended by jumping to an otherwise unused label that uses an End statement followed by a jump to the proper label. For example, the above program could be rewritten like so:
0->X Lbl 0 While X=1 X+1->X Disp X Goto 2 End Return Lbl 2 End Goto 0
This would avoid the problem by causing the 83+ to terminate the While conditional prior to jumping.
Examples
:While X =/= 105 :Getkey -> G :End
Or, if you desire the use of other operators, such as And, Or, or Xor:
:While X=5 and Y=/=3 :Input "",A :A+X->Y :End