User Tools

Site Tools


crpl:docs:break

<- CRPL reference <- Flow Control

break

ArgumentsResultNotation

Description

Immediately exits the body of a 'while/repeat/endwhile' block or a 'do/loop' block.

Examples

# 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
# Trace random numbers between 0 and 9, until we find number 0.

ShowTraceLog
ClearTraceLog
while TRUE repeat
	0 10 RandInt ->random
	<-random Trace
	<-random eq0 if
		break
	endif
endwhile
crpl/docs/break.txt · Last modified: 2021/02/05 11:43 by Karsten75