Here's the thing, though: even though this page isn't written with many try-it-yourself exercises, you should still try things yourself. A person's process of learning a language is similar to humanity's process of learning about nature: ultimately she can't be sure she knows anything without generating hypotheses and then subjecting those hypotheses repeatedly to falsification tests. So, for example, one thing you'll learn here is how Netlogo deals with while loops. Say you read about Netlogo's while loops and you think you understand. You can't be sure that you do understand until you try writing one out. Create a silly little task -- something very simple, with no purpose other than to test your understanding -- and implement it. And don't just implement it once. Do it every way that you can think of, using the while loop. Try it with parentheses, try it with square brackets. Try it using different kinds of boolean statements. Try it with several statements on several lines, try it with several statements on the same line. Don't simply test your understanding -- probe it for gaps. If you subject your knowledge of Netlogo's syntax and of Netlogo programming strategies more generally, your understanding of Netlogo will definitely include errors.
So, what follows is a model of Netlogo. It has actors and interactions, and it has other features described in HowToBuildAModel.
1. Actors
The actors in Netlogo are called agents. There are three broad classes of agents: turtles, patches, and the observer. Everything you want to happen in Netlogo is done by something, and that something is always an agent. Whenever you have a problem thinking about some task you want to program in Netlogo, your first question to yourself should be, whom do I want to ask to do this? Your answer will be an agent of some sort.-
The observer
-
You can more or less ignore the observer. The observer can be thought of as the Netlogo program itself. The observer is the agent that does things like clear-all and create, and it's also who does histograms and show commands.
-
Turtles
-
Patches
