User Tools

Site Tools


crpl:docs:do

Differences

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

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
crpl:docs:do [2013/01/14 14:05] – created virgilwcrpl:docs:do [2019/04/14 14:42] Grabz
Line 1: Line 1:
-TODO+~~DISCUSSION~~ 
 +<- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#flow_control|Flow Control]] 
 +=====  do  ===== 
 + 
 +^ Arguments ^ Result ^ Notation ^ 
 +|Limit and Index| |%%i1 i2 --%%| 
 + 
 + 
 +=== 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, excecution will proceed at the first statement following Loop.  
 + 
 +Loops can be nested, however, indexes of loops with a nesting difference more than 3 will become unreachable, unless they were saved to a variable. See: [[crpl:docs:i|I]], [[crpl:docs:i|J]] and [[crpl:docs:i|K]]. 
 + 
 +For more complex loops, see [[crpl:docs:while|While]]. 
 + 
 +<note tip>Limit comes first, then the initial value (index).  This means that the first number should always be bigger than the second number.</note> 
 +=== Examples === 
 +<code> 
 +# Show the trace log, clear it, then show the numbers 0 through 4 in the log  
 +ShowTraceLog  
 +ClearTraceLog  
 +5 0 do  
 +   I Trace  
 +loop 
 +</code>  
crpl/docs/do.txt · Last modified: 2021/02/05 11:43 by Karsten75