This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| prpl:func [2016/12/02 23:33] – external edit 127.0.0.1 | prpl:func [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | <- [[.: | + | <- [[.: |
| - | ===== | + | ===== |
| ^Arguments^Result^Notation^ | ^Arguments^Result^Notation^ | ||
| Line 8: | Line 8: | ||
| === Description === | === 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 ' | ||
| + | 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 [[.: | ||
| + | |||
| + | <!-- This page is " | ||
| === Examples === | === Examples === | ||
| - | < | + | < |
| + | 1 ->SomeVar | ||
| + | |||
| + | 10 @Square Trace #Will trace 100 | ||
| + | :Square # [ number - square] Describe your function | ||
| + | -> | ||
| + | < | ||
| + | < | ||
| + | " | ||
| + | endif | ||
| + | </ | ||