NetLogo banner

Home
Download
Help
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

  Donate

NetLogo Models Library:
Code Examples

(back to the library)

Ask-Concurrent Example

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web

WHAT IS IT?

This example demonstrates the difference between the ask and ask-concurrent commands.

Note: using ask-concurrent is not recommended. It is only there for backward compatibility.

HOW TO USE IT

Press SETUP to make some turtles.

Then press either of the two buttons that ask the turtles to go forward 5 steps. (Don't leave them both pressed at once.)

At the normal speed, the turtles may move so fast you won't see how the buttons are different. If needed, use the speed slider to slow down the model until you can watch the turtles move one at a time.

The GO button uses ask-concurrent in a slightly more elaborate way. It shows turtles acting currently even though each turtle is running a while loop, not just a simple fd command.

THINGS TO NOTICE

How do the turtles move with ask turtles [ fd 5 ] ?

How do they move with ask-concurrent instead of ask?

For details on ask-concurrent, read the Ask-Concurrent section of the Programming Guide in the NetLogo User Manual.

NETLOGO FEATURES

The view update mode is set to "continuous" so you can see the agents move one at a time by moving the slider towards "slower".

(back to the NetLogo Models Library)