Loops/While: Difference between revisions

m
added output
m (added output)
 
(5 intermediate revisions by 5 users not shown)
Line 1,046:
40 LET I=INT (I/2)
50 GOTO 20</syntaxhighlight>
 
==={{header|SmallBASIC}}===
<syntaxhighlight lang="langurqbasic">var .i = 1024
i = 1024
forWHILE .i > 0 {
PRINT i
i = i \ 2 ' Using \ for integer division instead of /
}WEND</syntaxhighlight>
 
==={{header|TI-83 BASIC}}===
Line 1,564 ⟶ 1,572:
 
=={{header|Elena}}==
ELENA 46.x:
<syntaxhighlight lang="elena">public program()
{
Line 1,570 ⟶ 1,578:
while (i > 0)
{
console.writeLine:(i);
i /= 2
Line 1,592 ⟶ 1,600:
(message "%d" i)
(setq i (/ i 2))))</syntaxhighlight>
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
int i = 1024
while i > 0
writeLine(i)
.i \/= 2
end
</syntaxhighlight>
 
=={{header|Erlang}}==
Line 2,153 ⟶ 2,170:
 
=={{header|langur}}==
0.8 changed the keyword for a test only loop from for to while.
 
{{works with|langur|0.8}}
<syntaxhighlight lang="langur">var .i = 1024
while .i > 0 {
writeln .i
.i \= 2
}</syntaxhighlight>
 
{{works with|langur|< 0.8}}
<syntaxhighlight lang="langur">var .i = 1024
for .i > 0 {
writeln .i
.i \= 2
Line 3,269 ⟶ 3,276:
end while;
end func;</syntaxhighlight>
{{out}}
<pre>
1024
512
256
128
64
32
16
8
4
2
1
</pre>
 
=={{header|SenseTalk}}==
Line 3,753 ⟶ 3,774:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">var i = 1024
while (i > 0) {
System.print(i)
57

edits