repeat repeats a certain number of times
repeat 5 [ wander ]
repeat random count turtles [ wander ]
while repeats as long as a condition is true
while not any? turtles-here [ wander ]
loop repeats forever (until
loop [ wander if any? turtles-here [ stop ] ]
tickadvances tick counter by 1.
ticksis always an integer.
tickscan have fractional values.
to go ask patches [ do-patch-stuff ] ask turtles [ do-turtle-stuff ] tick if ticks > run-duration [stop] end
to go tick if ticks > run-duration [stop] ask patches [ do-patch-stuff ] ask turtles [ do-turtle-stuff ] end
ask: Asks turtles in a random order.
ask turtles [do-sales]
Suppose we wanted bigger turtles to act before the smaller ones?
foreach sort-on [(- size)] turtles [ next-turtle -> ask next-turtle [do-sales] ]
This is a relic from older versions and can create problems if you use it.
set original shadow-copy)