Loops/While: Difference between revisions

Merged and rewrote code from Loop Structures per deprecated tag
(Racket)
(Merged and rewrote code from Loop Structures per deprecated tag)
Line 52:
+1024 +512 +256 +128 +64 +32 +16 +8 +4 +2 +1
</pre>
 
=={{header|AmbientTalk}}==
Note: in AmbientTalk, while:do: is a keyworded message (as in Smalltalk).
Both arguments to this message must be blocks (aka anonymous functions or thunks).
 
<lang ambienttalk>
// print 1024 512 etc
def i := 1024;
while: { i > 0 } do: {
system.print(" "+i);
i := i/2;
}
</lang>
 
=={{header|AmigaE}}==
Line 205 ⟶ 218:
(print i)
(setq i (floor i 2)))</lang>
 
=={{header|Crack}}==
<lang crack>i = 1024;
while( i > 0 ) {
cout ` $i\n`;
i = i/2;
}
</lang>
 
=={{header|D}}==
Line 233 ⟶ 254:
People may think all loops in Dc looks alike. In fact, there aren't loop, but conditional execution in Dc. You expand and execute the content of a register (in here, p) whenever the condition is satisfied.
<lang Dc>1024[p2/d0<p]dspx</lang>
 
=={{header|Dao}}==
<lang dao>i = 1024;
while( i > 0 ) i = i / 2;
</lang>
 
=={{header|Delphi}}==
Line 358 ⟶ 384:
STOP
END</lang>
 
=={{header|Frink}}==
<lang frink>
i=1024
while i>0
{
i = i/1
}
</lang>
 
=={{header|GML}}==
Anonymous user