Loop structures: Difference between revisions

Content added Content deleted
No edit summary
(Added Toka)
Line 878: Line 878:
puts [incr i]
puts [incr i]
}
}

==[[Toka]]==
[[Category:Toka]]

=== iterate ===
Counts down, executing a quote until the counter reaches 0.

10 [ i . ] iterate

=== +iterate ===
Counts up, executing a quote until the counter reaches the requested count.

10 [ i . ] +iterate

=== whileTrue ===
Repeatedly executes a quote until the quote returns true.

100 [ dup . 1- dup 0 <> ] whileTrue

=== whileFalse ===
Repeatedly executes a quote until the quote returns true.

0 [ dup . 1+ dup 101 = ] whileFalse


==[[UNIX Shell]]==
==[[UNIX Shell]]==