User Tools

Site Tools


4rpl:baserpl:flow_control:do

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
4rpl:baserpl:flow_control:do [2019/03/17 23:10] – external edit 127.0.0.14rpl:baserpl:flow_control:do [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-~~NOTOC~~ 
- 
-====== do ====== 
-do(5 0) 
- 
-===== Description ===== 
-The statements following the do, up to the loop statement, are executed repeatedly. Each iteration (loop), the initial value (Index) is incremented by one at the bottom of the loop and compared to Limit. When Index=Limit, execution will proceed at the first statement following Loop. Loops can be nested, but no more than 3 deep. 
- 
-NOTE: Limit comes first, then the initial value (index). This means that the first number should usually be bigger than the second number. 
- 
-===== Examples ===== 
-<code 4rpl> 
- 
-# single loop 
-do(5 0) 
-   trace(I) 
-loop 
-#  Prints: 
-#  0 
-#  1 
-#  2 
-#  3 
-#  4 
- 
-Nested loops 
- 
-do(2 0) 
-    trace(I) 
-    Do (4 2) 
-        Trace2 (J I) 
-        Do (6 4) 
-            Trace3 (K J I ) 
-        loop 
-    loop 
-loop 
- 
-</code> 
  
4rpl/baserpl/flow_control/do.1552864204.txt.gz · Last modified: 2025/02/14 14:56 (external edit)