<- PRPL reference <- Vars and Functions

:FUNC_NAME (Function Definition)

ArgumentsResultNotation
[ - ]

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 '@FUNC_NAME' call. The end of a function block is either the end of the script or the beginning of another function, whichever comes first.

Notes:

See also @FUNC_NAME (call).

<!– This page is “func” on the wiki, because filenames cannot contain : –>

Examples

1 ->SomeVar
 
10 @Square Trace #Will trace 100
 
:Square # [ number - square] Describe your function
	->NumberToSquare #Take the argument left on the stack.
	<-NumberToSquare dup mul #Square the number
	<-SomeVar if
		"Something important happened" Trace
	endif