The LOGO language allows certain events to be triggered by internal commands - these commands are called
primitives. Each primitive may have a certain number of parameters which are called arguments. For
example, the primitive cs, which clears the screen, takes no arguments, while the primitive sum takes two
arguments.
print sum 2 3 will return 5.
LOGO arguments are of three kinds:
print "hello |
This command displays hello. If you forget the ", the interpreter will return an error message. In effect, print expects an argument, or for the interpreter, hello does not represent anything, since it is not a number, a word, a list, or an already defined procedure.
Note: Numbers are treated in some instances as a numeric value (eg: fd 100), and in others as a word (eg: print
first 12 writes 1).
Several primitives have a general form, it means they could be used with an undefined number of arguments. All those primitives are on the table below:
|
To notify the interpreter that these primitives will be used in their general form, we have to write our command into parenthesis, look at those examples below:
print (sum 1 2 3 4 5) 15 (list [a b] 1 [c d]) I don’t know what to do with [[a b] 1 [c d]]? if (and 1=1 2=2 8=5+3) [fd 100 rt 90] |