Modular Programming
Export#
Cafe supports export of variables and functions using export keyword in global scope.
Every variable and function is private by default unless it is marked as ‘export’.
Variables and functions can be marked as export at the time of declaration.
Syntax
Example
Import#
Cafe module can import all the exported variables and functions from the specified module.
All Imported modules are executed transitively at runtime & cyclic dependency will flag runtime error.
Note: The .class file of a module at
module_pathshould be available while running current module.
Syntax
Example