Here is my function where I try to run ABM model inside a function. Now inside this function when I initialise model it works and also prints model but while using step!()
it says model is not defined. Can someone shed light? why step!()
not recognising model defined inside function ? @Datseris
### No global initialisation of model
function runn(i)
model = random_model() # model definition
println(model) # prints perfectly
step!(model, step_point) # I get error here ---- model not defined
end
for i in 1:4
runn(i)
end
Output:
ERROR: UndefVarError: `model` not defined