up previous next

read commands from a file or device

source S: STRING

This command executes all CoCoA commands in the file or device named S. A typical use of source is to collect user-defined functions and variables in a text file, say, MyFile.coc and then execute:
    source "MyFile.cocoa5";
or, equivalently, the obsolescent
    << "MyFile.cocoa5";
Functions and variables read in from a file in this way will erase functions and variables with identical names that may already exist. This can be avoided by using packages. Repeatedly used functions can be read into CoCoA at start-up by using source in the userinit.coc file.
See Also