Talk:Loops/While: Difference between revisions

(→‎DC: new section)
Line 52:
</pre>
A WHILE should test first and execute the body only if the test succeeded.
 
Alternative version (needs review when my caffeine level is ok):
<pre>
$ dc<<end
[q]sQ # makro Q : quit 2 levels (quit Q and calling level)
1024 [ d0!<Q # compare, quit if true
p 2 / # print and divide
lWx # tail recursion
] dsWx # duplicate store as W execute TOS
end
1024
512
256
128
64
32
16
8
4
2
1
</pre>
 
--[[User:Yeti|Yeti]] ([[User talk:Yeti|talk]]) 04:42, 26 November 2018 (UTC)
169

edits