Loops/While: Difference between revisions

Content deleted Content added
Phunanon (talk | contribs)
→‎Insitux: implementation
Adding Mia code
 
(10 intermediate revisions by 8 users not shown)
Line 312:
end;
end</syntaxhighlight>
 
=={{header|Amazing Hopper}}==
<syntaxhighlight lang="c">
#include <jambo.h>
 
Main
i=1024
Loop
Printnl 'i'
i \= 2
Back if 'i' is positive
End
</syntaxhighlight>
<p>Assembler Hopper code:</p>
<syntaxhighlight lang="amazing hopper">
main:
i=1024
____CODE_JUMP____883612951:,
{i};{"\n"}print;
i\=2
{i},jpos(____CODE_JUMP____883612951),____CODE_JUMP____854411479:,
emptystack?do{{0}};return
</syntaxhighlight>
{{out}}
<pre>
1024
512
256
128
64
32
16
8
4
2
1
</pre>
 
=={{header|AmbientTalk}}==
Line 1,009 ⟶ 1,046:
40 LET I=INT (I/2)
50 GOTO 20</syntaxhighlight>
 
==={{header|SmallBASIC}}===
<syntaxhighlight lang="qbasic">
i = 1024
WHILE i > 0
PRINT i
i = i \ 2 ' Using \ for integer division instead of /
WEND</syntaxhighlight>
 
==={{header|TI-83 BASIC}}===
Line 1,527 ⟶ 1,572:
 
=={{header|Elena}}==
ELENA 46.x:
<syntaxhighlight lang="elena">public program()
{
Line 1,533 ⟶ 1,578:
while (i > 0)
{
console.writeLine:(i);
i /= 2
Line 1,555 ⟶ 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,116 ⟶ 2,170:
 
=={{header|langur}}==
<syntaxhighlight lang="langur">
0.8 changed the keyword for a test only loop from for to while.
var i = 1024
 
while i > 0 {
{{works with|langur|0.8}}
writeln i
<syntaxhighlight lang="langur">var .i = 1024
while .i > 0 {i \= 2
}
writeln .i
</syntaxhighlight>
.i \= 2
}</syntaxhighlight>
 
{{works with|langur|< 0.8}}
<syntaxhighlight lang="langur">var .i = 1024
for .i > 0 {
writeln .i
.i \= 2
}</syntaxhighlight>
 
=={{header|Lasso}}==
Line 2,320 ⟶ 2,366:
a := a div 2;
endfor</syntaxhighlight>
 
=={{header|Mia}}==
<syntaxhighlight lang="miniscript">i = 1024
while i > 0 {
print i
i = i :/ 2
}</syntaxhighlight>
 
=={{header|min}}==
Line 2,703 ⟶ 2,756:
end
end.</syntaxhighlight>
 
 
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
##
var n := 1024;
while n > 0 do
begin
Println(n);
n := n div 2;
end;
</syntaxhighlight>
 
=={{header|PeopleCode}}==
Line 3,232 ⟶ 3,297:
end while;
end func;</syntaxhighlight>
{{out}}
<pre>
1024
512
256
128
64
32
16
8
4
2
1
</pre>
 
=={{header|SenseTalk}}==
Line 3,716 ⟶ 3,795:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">var i = 1024
while (i > 0) {
System.print(i)