DO
Initiates a conditional loop, whose condition is to be evaluated at the end of each pass
Implemented by:
With variations:
Also written as:
Usage
DO is a quite generic word, but in BASIC it is mainly used with loop structures — yes, more than one.
It can be used in a DO…LOOP without a condition, and the block of commands is repeated until an EXIT is found:
110 DO ... ' whatever commands here 150 LOOP
For running the loop while and only if a condition evaluates to Boolean true, there is the DO WHILE…LOOP:
110 DO WHILE A <= 100 120 A = A + 1 130 DIF = DIF + 1 140 LOOP
Sometimes you'd want a block to execute at least once and repeat while a condition is not met. You will appreciate the DO… LOOP UNTIL structure:
110 DO 120 A = A + 1 130 DIF = DIF + 1 140 LOOP UNTIL A = 100
Variations
Examples
Comments
Related keywords
Similar keywords
In other languages...
References
- https://manpages.ubuntu.com/manpages/xenial/man1/bwbasic.1.html , last checked 2023-02-11