Scope of Variables
By default, variable and function names are recognized globally (as in the BASIC language). Once a name is mentioned
in a valid FISH statement, it is thereafter recognized globally, both in FISH code and in PFC commands (for example,
using the @ symbol or inline FISH in place of a number). A variable also appears in the list
of variables displayed when the fish list symbols
command is given. If the local identifier is used to declare a
variable, the variable is considered local to that function and is not available once the function has been executed.
Local variables supersede global variables in a function. If the FISH variable automatic creation option is disabled
(see the fish automatic-create
command), all global variables must be declared with the global keyword.
A global variable may be given a value in one FISH function and used in another function or in a PFC command. The
value is retained until it is changed. The values of all global variables are also saved by the model save
command
and restored by the model restore
command.
⇐ Reserved Names for Functions and Variables | Functions: Structure, Evaluation, and Calling Scheme ⇒
Was this helpful? ... | PFC 6.0 © 2019, Itasca | Updated: Nov 19, 2021 |