Function

Functions are snippets of code that can be called multiple times. They can be run with arguments, which can be even more useful.

Example
Code: local myFunction print("Hello World!") end

myFunction

Output:

Hello World!

Functions can also be called multiple times. Take this example below:

Code:

local myFunction print("Hello World!") end

myFunction myFunction myFunction myFunction

Output:

Hello World! Hello World! Hello World! Hello World!

Functions can also have arguments like this example:

local myFunction(text) print(text) end

myFunction("foobar")

Output:

foobar