Skip to main content

Modules

In LemonScript, a module is a class that you can import into a file. For example:

import random # importing the random moduleprint(random.randint(1, 10)) # random number between 1 and 10

The syntax for importing a module is:

import [module name] as [variable name]

The as [variable name] is optional, but it defines the module with a different variable name. This is useful if the module name is already defined. Without it, the module is auto defined to the module's name. Now, you can treat the module as a class. Some modules even have static properties. A list of all the modules and their methods and what they do can be found in the next couple of files.