pub Functions and Visibility
Expose functions across files.
Files Are Modules
In Zig every source file is its own module. What it shares with other files is controlled by visibility rules. 📦
Private by Default
A plain function is private to its file. Other files cannot call it, which keeps internal helpers safely hidden.
fn helper() void {
// only this file can call me
}All lessons in this course
- Function Syntax and Return Types
- Passing Values vs References
- pub Functions and Visibility
- Recursion and Multiple Returns