We can think of a global variable as a pond attribute. These attributes often apply to the entire population of agents.
Here is how they are declared:
globals [init-population init-infected fatal?]
We can change the value of a global variable using the set command:
set VARIABLE EXPRESSION
For example:
to init-globals
set init-population 100
set init-infected 20
set fatal? true
end
In the following procedure we create init-population turtles:
to init-model
init-globals
crt init-population
ask turtles [init-turtle]
end