shared¶
Syntax¶
Parameters¶
<variable_type>-
The type of the variable being declared. Valid variable types are:
Important
For
agent-scoped variables,tableandlist_tablevariable types are currently disabled, as they would be extremely memory-intensive with fairly ordinary numbers of agents.
<variable_name>- A name to give the newly declared variable. If multiple are present, they must be separated by a space. Variable names must start with a letter and contain no symbols.
Description¶
A keyword used to declare a globally scoped variable in a FRED model. This statement can be used in a variables block.
Prefixing a variable declaration with the shared scope indicates that one
instance of the variable will exist for the entirety of a simulation.
A shared variable can be accessed and modified by any agent.
If you would like each agent to have its own copy of a variable in a simulation, see agent.
Examples¶
The following declares a numeric my_num, and declares two lists, my_list1
and my_list2.