StarLogo Vocabulary:


Control Structure Commands


= used for the observer,
= used for turtles,
= used for patches


_____________________________________________________________
every
number procedure-list

Executes procedure-list every number seconds. Can be used only inside of
a "forever button."
_____________________________________________________________
if
predicate procedure-list

If predicate evaluates to true, then execute procedure-list.

Example:
if xcor > 0 [setc blue]
(Turtles on the right half of the screen turn blue.)
_____________________________________________________________
ifelse
predicate proc-list1 proc-list2

If predicate evaluates to true, then execute proc-list1. If
predicate evaluates to false, then execute proc-list2.

Predicate may have different values for different objects, so some objects may
execute consequent-procedure while others execute alternate-procedure.

Example:
ifelse xcor > 0 [setpc blue] [setpc red]
(The left half of the screen turns red and the right half turns blue.)
_____________________________________________________________
ifelse-report
boolean ilist1 ilist2

If boolean is true, executes ilist1 and returns its value.
If boolean is false, executes ilsit2 and returns its value.
_____________________________________________________________
output
thing

Does a non-local exit from the current procedure and returns anything to the caller.
You cannot call this from the command center.
_____________________________________________________________
repeat
number procedure-list

Executes procedure-list number times.

Example:
pd repeat 36 [fd 1 rt 10]
(Each turtle draws a circle.)
_____________________________________________________________
stop

Exits immediately from the current procedure.
_____________________________________________________________
wait
number

Waits for number seconds.
=============================================================