WHILE [...] LOOP will repeat the statements between WHILE and
LOOP, while the condition is true.
If the condition isn't
true when the WHILE statement begins, none of the statements will be
The DO is optional in ARMbasic.
WHILE loops have the lowest overhead of all looping constructs, so they are
faster than FOR or DO loops
An EXIT is the proper way to leave a WHILE...LOOP, you can
also use a GOTO or RETURN statement.
' a good way to time
x = 1000000
1 ' decrement x
y = y *
z ' do something to measure here -- like
multiply for instance
Finished in 181 msec (on PROplus)
so with loop
overhead of 121 msec, that's 60 nsec to multiply 2
Differences from other BASICs
- Visual BASIC uses the syntax DO WHILE ... LOOP, which is allowed by
- PBASIC also requires the DO
- Some BASICs use WHILE ... WEND