<- [[.:prplreference| PRPL reference]] <- [[.:prplreference#vars_and_functions|Vars and Functions]] ===== :FUNC_NAME (Function Definition) ===== ^Arguments^Result^Notation^ | | | [ - ] | === 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: * Functions use the same stack and variables as the rest of the script. * This is useful for passing arguments. * The :FUNC_NAME is essentially a marker for where the script should go when @FUNC_NAME is encountered. * When a function finishes, the script keep executing from after the @FUNC_NAME that triggered it See also [[.:call|@FUNC_NAME (call)]]. === 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