Loops/While: Difference between revisions

Added ZX81 BASIC
(Added ZX81 BASIC)
Line 1,884:
 1024  511  254  126   62   30   14    6    2 
</pre>
 
=={{header|Sinclair ZX81 BASIC}}==
The distinctive thing about a <code>while</code> loop is that the conditional test happens before the loop body, not after—so that the code in the loop may be executed zero times.
 
Since we have no integer type, we floor the result of the division each time.
<lang basic>10 LET I=1024
20 IF I=0 THEN GOTO 60
30 PRINT I
40 LET I=INT (I/2)
50 GOTO 20</lang>
 
=={{header|Slate}}==
519

edits