Functions are similar to Aliases except that they can return a value like a variable. In fact, a Function is called like a variable, using the @ character, with an optional list of arguments separated by commas and enclosed in parenthesis.
For example:
You can create special Variables that also work like "inline" functions and do not require the #RETURN command. These inline functions are defined using the #VARFUNC command. For example:
Notice that inline functions only contain a single expression that is returned (so no #RETURN command is needed). Regular functions defined with #FUNCTION can contain any sort of processing, loops, conditions, etc and can be much more complex than simple inline functions.
NOTE: Full functions were added in v2.0. In versions prior to 2.0, the #FUNCTION command created an "inline" function and there wasn't any #VARFUNC command.
Add comment