Talk:Loops/While: Difference between revisions

m
added a section header to the first topic to properly place the table-of-contents (TOC) --- (this happens more often than one would think).
m (added a section header to the first topic to properly place the table-of-contents (TOC) --- (this happens more often than one would think).)
 
(One intermediate revision by one other user not shown)
Line 1:
== number should be INT ? ==
 
Perhaps it should be specified that the number should be int or the number to count down to should be '1' rather than '0' The reason is that for languages that support the numbers rather than integers, the value only tends towards '0' never reaching it :)
 
Line 54 ⟶ 56:
 
Alternative version (needs review, comment, adopt, ...):
 
{{works with|GNU Dc}}
{{works with|OpenBSD Dc}}
If the comments are omitted: {{works with|AT&T Dc}}
<pre>
$ dc<<end
[ q ]sQ sQ # makro Q : quit 2 levels (quit Q and calling level)
1024 [ d0d 0!<Q # compare, quit if true
p 2 / # print and divide
lWxlW x # tail recursion
] dsWxd sW x # duplicate store as W execute TOS
end
1024