LOAD

Synopsis
LOAD filename
Description

Reads instructions from the file named filename and executes them. The file can include procedure definitions with TO, and these are accepted even if a procedure by the same name already exists. If the file assigns a list value to a variable named STARTUP, then that list is RUN as an instruction list after the file is loaded.

It is important to understand that the file is executed, not copied, into the workspace:

  • If Logo sees a TO instruction, then it will define that procedure (the code within a definition is not executed).

  • If Logo sees a MAKE instruction, then it will make that name.

  • If Logo sees instructions that are outside of a procedure definition, then it will run that those instructions in the order seen.

Example
TO MYPROGRAM1
  PRINT "Hello1
END

TO MYPROGRAM2
  PRINT "Hello2
END

POTS
TO MYPROGRAM1
TO MYPROGRAM2

SAVE "myprograms.lgo
ERALL
POTS
LOAD "myprograms.lgo
POTS
TO MYPROGRAM1
TO MYPROGRAM2

SourceForge.net Logo