Terrapin Resources

Terrapin Logo 4 has been discontinued! Our new Terrapin Logo version is much more powerful and modern; we strongly recommend that you update to our latest release of the Logo programming language.

Background procedures

Working with background procedures.

Background procedures are procedures or runlists that run in the background at the same time as a normal program. There are commands available that launch a runlist or a procedure in the background.

HALT

Stops one or all background procedures.

Syntax

Description

HALT causes one or more running background procedures to stop execution. The input to HALT is the ID of a background procedure. Background procedures that have been launched with the LAUNCH command have numbers as IDs.

If HALT is used without inputs, it stops all running background procedures.

See also LAUNCH and LAUNCHED.

LAUNCH

Launches a runlist or procedure for execution in the background.

Syntax

Description

LAUNCH launches a Logo run list or a procedure to be run in the background. This run list or procedure runs simultaneously with other Logo procedures. The output of LAUNCH is an ID number which can be used with the HALT command to halt a running background procedure. A maximum of 1000 background procedures can be active at the same time.

Background procedures may unexpectedly alter the value of any Logo variable. A few system variables, however, are treated differently. The values of :STANDARD.INPUT, :STANDARD.OUTPUT, and :CASE are local to any procedures started with the LAUNCH command or run by clicking a control, a turtle, or a bitmap. Such procedures obtain their own copy of these variables. Setting one of these variables inside a LAUNCHed procedure does not affect the global setting. This makes it possible for a LAUNCHed procedure to, for example, change the value of :STANDARD.OUTPUT to a file without affecting the :STANDARD.OUTPUT channel of another procedure.

Do not delete any turtle while a LAUNCHed procedure moves a turtle. Logo may crash!. Do not use any of the commands SETTURTLES, CTURTLES, or LTURTLES, for example.

See also HALT and LAUNCHED.

Example

TO CREEP ASK 1 [ SETPC 2 ST PD SETSPEED 0.1 SETH HEADING + (RANDOM 60) - 30 FORWARD RANDOM 20 ] CREEP END

LAUNCH “CREEP </span>