Turtle, Observer

to procedure-name

Parameters:
procedure-name Anything A single word which is the name of the procedure you wish to define

Description:
When you create a procedure, the first line of it must be to procedure-name where procedure-name is a one-word title for your procedure. procedure-name cannot be any command already recognized by StarLogo (this includes both built-in commands and the procedure names of other procedures you may already have written).

To add parameters to a procedure, write them after the procedure-name with a colon in front of them, like this:
to my-procedure :x :y :z

Inside the procedure body, you may use :x, :y and :z to refer to the values of the arguments passed in by the caller of the procedure.

All procedures must be ended with the word end on a line by itself (no comments may be on that line).

Procedures defined in the turtle procedures pane are only callable by turtles. Procedures defined in the observer procedures pane are only callable by the observer. Patches may not have procedures.

Examples:
to go
fd 1
rt 90
end

Now you may use go as a command in other parts of your program.

Related Commands:
end output startup stop