LEARN VOID / FOUNDATIONS
Modules & imports
Organize a program into small source files.
Keep these paths relative to main.void: math/calculator.void and helpers/numbers.void. The downloaded main file imports both.
use "/math/calculator.void" as calculator
use "/helpers/numbers.void"
func entry(value: i32) -> i32:
return calculator.double(value) + increment(value)Import with use
use imports a source file. An as alias gives its declarations a qualified name, while an unaliased import permits unambiguous direct names.
Read the path in project context
The entry file’s parent directory establishes the project root. A leading slash in an import is relative to that virtual root, not the operating system’s root directory. Relative dot paths resolve from the importing file.
Keep the example together
This example needs main.void plus math/calculator.void and helpers/numbers.void. The calculator doubles 5 and increment adds one to 5, giving 16. Package imports and escapes outside the project root remain outside the supported import model.