Luau
Functions

Functions

Functions are a really powerful concept in computer science, you've already been using functions the entire time. print and typeof are functions.

A function is simply a “chunk” of code that you can call multiple times. Everytime you do print() this function is called, and a chunk of code is then responsible for displaying the text to the output.

You can also create your own functions, lets create a function that adds two numbers together and prints the result.

local function add(a, b)
   print(a + b)
end
 
add(5, 2)