User Tools

Site Tools


crpl:docs:func

Differences

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

Link to this comparison view

Next revision
Previous revision
crpl:docs:func [2013/01/14 13:40] – created virgilwcrpl:docs:func [2022/06/28 15:32] (current) – Reformat Karsten75
Line 1: Line 1:
-TODO+ 
 +<- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#vars_and_functions|Vars and Functions]] 
 + 
 +=====  :FUNC_NAME  ===== 
 + 
 +===== Syntax ===== 
 + 
 +:FunctionName 
 + 
 + 
 +=== Description === 
 +Defines the beginning of a function block.  
 +Choose a unique name for the function.  
 +Statements after a function block only execute if called by invoking the  
 +function with an '@FunctionName' call.  
 +The end of a function block is either the end of the script or the  
 +beginning of another function, whichever comes first. 
 +=== Examples === 
 +<code 4RPL> 
 +# --- Roll a 100 sided die--------------  
 +# --- Return true or false randomly.  
 +# --- The value on the stack is the percentage chance.  
 +# --- [ Chance_in_100 -- true/false]  
 +:chance  
 + # Take an item from the stack, divide by 100,  
 + # then compare to a random float.  
 + 100.0 div RandFloat gt 
 +</code>  
 + 
crpl/docs/func.1358188820.txt.gz · Last modified: 2014/10/01 15:02 (external edit)