Imports

Modules, upon modules, upon modules... is this Node?

Imports are extremely useful for modularizing your code. The import statement is used to import code from other Caboose files. The import statement syntax is as so:

import "./path/to/your/file.cb"

The import location is relative to where you run the interpreter from. For example, if you run your code from /home/user/project and your main file is in ./main.cb and it imports code from "./math.cb", the file math.cb must be in the same folder as main.cb.

Example

example_import.cb
example_imported_file.cb
example_import.cb
import "./example_imported_file.cb"
print add(1, 2); // Prints 3
example_imported_file.cb
fun add(a, b) {
return a + b;
}