Files
c2/specs/IMPORTS.md
2026-04-25 15:28:33 +02:00

32 lines
539 B
Markdown

# Imports
The import statement allows one module access to the public declarations of another module.
## Syntax
The import statement uses the following syntax:
```c2
import module_name;
```
They can optionally be prefixed by the `public` keyword, in which case the module will
export everything in the import transitively.
For instance,
```c2
--- a.c2
module a;
import b;
--- b.c2
module b;
public import c;
--- c.c2
module c;
// Some declarations
```
In this example, both module a and b can access the declarations in module c.