next up previous contents index
Next: Specific character \ Up: Conventions adopted by XLOGO Previous: Commands and their interpretation   Contents   Index

Procedures

In addition to these primitives, you can define your own commands. These are called procedures. Procedures are introduced by the word to and conclude with the word end. They can be created using the internal XLOGO procedure editor. Here is a small example:

to square
repeat 4[forward 100 right 90]
end

These procedures can take advantage of arguments as well. To do that, variables are used. A variable is a word to which a value can be assigned. Here is a very simple example:

to twice :word
print :word
print :word
end

twice [1 2 3] -----> 1 2 3
                     1 2 3
See the various examples of procedures at the end of the manual.

Loïc 2008-06-08