Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

3. Modules

Modules are top-level containers for code. Each module serves as a compilation unit, housing functions, types, structs, and other definitions. Every module is given a program-unique name which is used for referencing it. A single source file may contain any number of modules.

Modules are used primarily for code organisation. Functionally, modules act as TweetyLang's analog to namespaces; however, modules need to be explicitly imported.