Programming in NetLogo

The NetLogo system includes an extensive, web-based user manual. The manual includes tutorials, a programming guide, and a dictionary that documents all built-in syntax, procedures, reporters, variables, and constants. It is the primary document programmers should consult (and consult frequently) for information about programming in NetLogo.

The following guide provides a quick overview.

Overview of NetLogo Programming

Agents (turtles, patches, and the observer) execute commands:

ask AGENT [COMMAND COMMAND ... ]

A procedure is a user defined command:

Defining Procedures

Commands may contain expressions. An expression computes a value such as the distance from a particular turtle to a particular patch or the perimeter of a polygon.

A reporter is a user-defined expression:

Defining Reporters

Complex commands can be built out of simpler ones using control structures such as if, ifelse, and while:

Sequence Control

Data values such as numbers, strings, agents, and Booleans (true and false) can be aggregated into composite values such as:

Lists, Strings, and Agent Sets