LUAU Interactive Tutorial

Lesson 1: Variables

Variables store values you can use later. Example:

local name = "Luau"
local age = 5
print(name, age)
Try it Yourself: Change the values of name and age and click Run!

Lesson 2: For Loops

For loops repeat a block of code a set number of times. Example:

for i = 1, 5 do
  print("Number:", i)
end
Try it Yourself: Change the loop to go from 1 to 10 or print something else!

Lesson 3: Functions

Functions let you reuse code. Example:

function greet(name)
  print("Hello " .. name)
end

greet("Luau")
Try it Yourself: Write a function that prints your favorite game or toy.

Lesson 4: Tables

Tables store multiple values together. Example:

local fruits = {"Apple", "Banana", "Cherry"}
for i, fruit in ipairs(fruits) do
  print(i, fruit)
end
Try it Yourself: Add more fruits or change the loop to print only the fruit names.