User Tools

Site Tools


crpl:docs:break

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
crpl:docs:break [2013/01/18 06:25] grauniadcrpl:docs:break [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
-~~DISCUSSION~~+
 <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#flow_control|Flow Control]] <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#flow_control|Flow Control]]
 =====  break  ===== =====  break  =====
Line 11: Line 11:
 === Examples === === Examples ===
 <code> <code>
-Display only odd numbers on the trace log +Iterate from 0 to 9, but only trace numbers from 0 to 5. 
 + 
 +ShowTraceLog 
 +ClearTraceLog 
 +10 0 do 
 + I Trace 
 + I 5 gte if 
 + break 
 + endif 
 +loop 
 +</code> 
 + 
 +<code> 
 +# Trace random numbers between 0 and 9, until we find number 0. 
 ShowTraceLog ShowTraceLog
-ClearTraceLog  +ClearTraceLog 
-do  +while TRUE repeat 
- I 2 mod eq0 if #divide inner loop with modulo 2 and test if zero  + 10 RandInt ->random 
- Break  + <-random Trace 
- endif  + <-random eq0 if 
- I Trace  + break 
- loop + endif 
-</code> +endwhile 
 +</code>
  
crpl/docs/break.1358490348.txt.gz · Last modified: 2025/02/14 14:56 (external edit)