Repeats the commands forever, or until the enclosing procedure exits through use of the stop or report commands.
to move-to-world-edge ;; turtle procedure
loop [
if not can-move? 1 [ stop ]
fd 1
]
end
In this example, stop exits not just the loop, but the entire procedure.
Note: in many circumstances, it is more appropriate to use a forever button to repeat something indefinitely. See Buttons in the Programming Guide.
Take me to the full NetLogo Dictionary