FANDOM


The normal Logo state is the command line where Logo displays a question mark (?) prompt and waits for you to type a command and press ENTER. When you press ENTER, Logo executes commands on the line. This Logo state is called toplevel.

When Logo executes a procedure, control of the program flow passes from toplevel to the procedure. As you saw in the recursive SQUARE procedures above, it is possible to write procedures that never return control to toplevel until they are interrupted by Control-G or the Stop button. You can write procedures that continue operation until certain conditions are met and then return control to toplevel.

It is also possible to write Logo procedures that maintain flow control even though they ask the user to enter information from the keyboard. The READ... series of primitives can be used to obtain information from the keyboard without returning flow control to toplevel. You can alter the SQUARE procedure to draw squares of the size specified from the keyboard:

? TO SQUARE

> PRINT [PLEASE ENTER A NUMBER BETWEEN 1 AND 200.]

> MAKE "SIDE READ

> REPEAT 4 [ FD :SIDE RT 90]

> SQUARE

> END

SQUARE defined

?

The SQUARE procedure will continue to run until you type Control-G to return flow control to toplevel.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.