#Is there any concept of `private functions` in zig?
1 messages · Page 1 of 1 (latest)
Yes, don't make it pub
fn xyz() void already is a private (meaning you can only access it from the same file).
In case this is why you didn't know: within a single file, all functions are declarations are visible. pub affects visibility for other files that import it.
That explains it, I was in the same file actually. So same file but private is not a thing then?
I guess not, since functions inside structs are just namespaced functions right?
Correct, your code is free to access anything in its own file. The pub/priv boundary only takes affect outside of the file