Loops/While: Difference between revisions

→‎{{header|ANSI BASIC}}: Added a solution.
(Added MSX Basic)
(→‎{{header|ANSI BASIC}}: Added a solution.)
Line 597:
 
=={{header|BASIC}}==
In general, the <code>WHILE</code>-<code>WEND</code> (or <code>DO WHILE</code>-<code>LOOP</code>) statement is used or it is simulated with a construct with conditional jump.
 
==={{header|ANSI BASIC}}===
{{works with|Decimal BASIC}}
<syntaxhighlight lang="basic">
100 LET I = 1024
110 DO WHILE I > 0
120 PRINT I
130 LET I = INT(I / 2)
140 LOOP
150 END
</syntaxhighlight>
{{out}}
<pre>
1024
512
256
128
64
32
16
8
4
2
1
</pre>
 
==={{header|Applesoft BASIC}}===
<syntaxhighlight lang="applesoft basic"> 10 I% = 1024
512

edits