Loop structures: Difference between revisions

Content added Content deleted
(+ Befunge)
(→‎[[Toka]]: Updated to reflect Toka R1)
Line 892: Line 892:
[[Category:Toka]]
[[Category:Toka]]


=== iterate ===
=== countedLoop ===
Counts down, executing a quote until the counter reaches 0.
Counts up or down until the boundaries are met.


10 [ i . ] iterate
10 0 [ i . ] countedLoop
0 10 [ i . ] countedLoop

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

10 [ i . ] +iterate


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


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


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


0 [ dup . 1+ dup 101 = ] whileFalse
0 [ dup . 1 + dup 101 = ] whileFalse


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