Return to homepage

DOSATO

Copyright © 2024 Sebastiaan Heins

2.5 Including and Importing

Dosato has a system for including and importing files.
This is useful for splitting up your code into multiple files, and reusing code.
The syntax for including a file is as follows: include "filename"
The syntax for importing a file is as follows: import "libraryname"
You can only import and include on a top level.

Including files

Including files is useful for splitting up your code into multiple files.
This can make your code more readable and maintainable.
To include a file, use the include keyword followed by the filename in quotes.
Example: include "myfile.to"
The file will be run, and the functions will become available.

Importing libraries

Dosato has support for external libraries written in C or other low level languages.
To import a library, use the import keyword followed by the library name in quotes.
Example: import "mylibrary"
The library will be loaded and the functions will become available.
More information on how to write libraries can be found in the Dosato library documentation.