LOAD

Synopsis
LOAD filename
Description

Reads instructions from the file named filename and runs 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 defines that procedure (the instructions between the TO and END are not immediately run, but instead become the body of the procedure).

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

  • If Logo sees instructions that are outside of a procedure definition, then it runs 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