July 2018
Beginner
202 pages
5h 42m
English
Once a function is declared, it can be executed by calling it. To call a function, simply type its name, followed by parentheses. For example, to read input from the console, you call io.read(). The following snippet demonstrates how to declare and call your own function:
print ('about to declare the PrintSomething function');function PrintSomething() -- declare the function print ('hello, world')endprint ('the PrintSomething function is declared');print ('calling the PrintSomething function');PrintSomething(); -- call the functionprint ('called the PrintSomething function');