Loops/While: Difference between revisions

added PostScript
(→‎{{header|Groovy}}: new solution)
(added PostScript)
Line 639:
i div 2 -> i;
endwhile;</lang>
 
=={{header|PostScript}}==
PostScript has no real <code>while</code> loop, but it can easily be created with an endless loop and a check at the beginning:
<lang postscript>1024
{
dup 0 le % check whether still greater than 0
{ pop exit } % if not, exit the loop
if
dup = % print the number
2 idiv % divide by two
}
loop</lang>
 
=={{header|PowerShell}}==
Anonymous user