LOGO Commands 3

The commands below control the logical flow of LOGO procedures and enable output from them. The command descriptions were adapted from the Berkeley Logo User Manual, Copyright 1993 by the Regents of the University of California.



TURTLE MOTION QUERIES
---------------------

XCOR							(library procedure)

	outputs a number, the turtle's X coordinate.

YCOR							(library procedure)

	outputs a number, the turtle's Y coordinate.



CONTROL STRUCTURES
==================

Note: in the following descriptions, an "instructionlist" can be a list
or a word.  In the latter case, the word is parsed into list form before
it is run.  Thus, RUN READWORD or RUN READLIST will work.  The former is
slightly preferable because it allows for a continued line (with ~) that
includes a comment (with ;) on the first line.

IF tf instructionlist
(IF tf instructionlist1 instructionlist2)

	command.  If the first input has the value TRUE, then IF runs
	the second input.  If the first input has the value FALSE, then
	IF does nothing.  (If given a third input, IF acts like IFELSE,
	as described below.)  It is an error if the first input is not
	either TRUE or FALSE.

	For compatibility with earlier versions of Logo, if an IF
	instruction is not enclosed in parentheses, but the first thing
	on the instruction line after the second input expression is a
	literal list (i.e., a list in square brackets), the IF is
	treated as if it were IFELSE, but a warning message is given.
	If this aberrant IF appears in a procedure body, the warning is
	given only the first time the procedure is invoked in each Logo
	session.

IFELSE tf instructionlist1 instructionlist2

	command or operation.  If the first input has the value TRUE, then
	IFELSE runs the second input.  If the first input has the value FALSE,
	then IFELSE runs the third input.  IFELSE outputs a value if the
	instructionlist contains an expression that outputs a value.

STOP

	command.  Ends the running of the procedure in which it appears.
	Control is returned to the context in which that procedure was
	invoked.  The stopped procedure does not output a value.

OUTPUT value
OP value

	command.  Ends the running of the procedure in which it appears.
	That procedure outputs the value "value" to the context in which
	it was invoked.  Don't be confused: OUTPUT itself is a command,
	but the procedure that invokes OUTPUT is an operation.


COMMUNICATION
=============

TRANSMITTERS
------------

PRINT thing
PR thing
(PRINT thing1 thing2 ...)
(PR thing1 thing2 ...)

	command.  Prints the input or inputs to the current write stream
	(initially the terminal).  All the inputs are printed on a single
	line, separated by spaces, ending with a newline.  If an input is a
	list, square brackets are not printed around it, but brackets are
	printed around sublists.  Braces are always printed around arrays.


Mtht420