Loops/Do-while: Difference between revisions

Line 514:
print a
loop while a mod 6 <> 0</lang>
 
==={{header|ASIC}}===
ASIC does not have a <code>do .. while</code> construct. Equivalent using <code>WHILE</code>:
<lang basic>
REM Loops/Do-while
 
I = 0
REM first iteration - before the While
I = I + 1
PRINT I
IMod6 = I MOD 6
WHILE IMod6 <> 0
I = I + 1
PRINT I
IMod6 = I MOD 6
WEND
 
END
</lang>
{{out}}
<pre>
1
2
3
4
5
6
</pre>
Equivalent using conditional jump:
<lang basic>
REM Loops/Do-while
 
I = 0
LoopStart:
I = I + 1
PRINT I
IMod6 = I MOD 6
IF IMod6 <> 0 THEN LoopStart:
 
END
</lang>
{{out}}
As above
 
==={{header|BaCon}}===
Line 574 ⟶ 617:
until mod(i, 6) = 0
print</lang>
 
 
=={{header|bc}}==
Anonymous user