[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.5 User-defined functions
User-defined functions take no arguments, and are evaluated as if a file
containing the function body was included at the location of the Call
statement.
-
Function string
Begins the declaration of a user-defined function named string. The body of the function starts on the line after `
Function string
', and can contain any Gmsh command.-
Return
Ends the body of the current user-defined function. Function declarations cannot be imbricated.
-
Call string;
Executes the body of a (previously defined) function named string.
See ‘t5.geo’, for an example of a user-defined function. A shortcoming of Gmsh's scripting language is that all variables are “public”. Variables defined inside the body of a function will thus be available outside, too!