Home Download Help Forum Resources Extensions FAQ NetLogo Publications Contact Us Donate Models: Library Community Modeling Commons Beginners Interactive NetLogo Dictionary (BIND) NetLogo Dictionary User Manuals: Web Printable Chinese Czech Farsi / Persian Japanese Spanish
|
NetLogo Models Library: |
If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web |
This shows how to use the run
command to give different breeds different definitions of the "same" procedure.
You could accomplish the same thing with code like this:
ifelse breed = dogs
[ dogs-speak ]
[ ifelse breed = cats
[ cats-speak ]
[ cows-speak ] ]
but such code is tedious to write and runs slower.
The run
command is fast when you use it over and over again on the same strings, so using this technique won't hurt the performance of your model.
(back to the NetLogo Models Library)