User Tools

Site Tools


crpl:docs:else

Differences

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

Link to this comparison view

Next revision
Previous revision
crpl:docs:else [2013/01/14 14:05] – created virgilwcrpl:docs:else [2015/03/19 23:28] (current) Karsten75
Line 1: Line 1:
-TODO+<- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#flow_control|Flow Control]] 
 +=====  else  ===== 
 + 
 +^Arguments^Result^Notation^ 
 +| | |''-- ''
 + 
 + 
 +=== Description === 
 +When the if statement evaluates to False, then the statements following the else, up to the endif, are executed instead. 
 +=== Examples === 
 +<code> 
 +# Pick a random integer between 0(inclusive) and 100(exclusive). 
 +# If the random number is less than 95 emit 10 Creeper, 
 +# otherwise emit 100 Creeper. 
 +0 100 RandInt 95 lt if  
 + CurrentCoords 10 AddCreeper  
 + else  
 + CurrentCoords 100 AddCreeper  
 + endif 
 +</code>  
crpl/docs/else.1358190300.txt.gz · Last modified: 2014/10/01 15:02 (external edit)