Working with modules
The modular programming approach offers maintainability and code re-usability. It also helps you to add abstractions and allows you to expose only necessary functionality to the consumers of the module. It is recommended that you learn how to work with modules and examine how to efficiently create and organize applications whose functionality span across modules. In this section, you will learn about the various principles to define and work with modules:
- The directory name must match the module name.
- Imported modules must be consumed in the code.
- Multiple V files in the module must define the same module.
- Both private and public members of a module can be accessed from anywhere within the module.
- Only public members of the module are accessible outside of the module.
- Cyclic imports are not allowed.
- Define
init
functions to execute one-time module-level initializer functionality.
All of the V code that is shown later in this...