Build a Function: Coding lesson for kids
In this lesson, children learn to define a function in Lua and call it with an argument.
function add(a, b): Defines a function named add that takes two inputs, a and b — no special keyword needed before "function".
return a + b: Sends the result back out to wherever the function was called.
end: Every function must close with "end".
This lesson is part of Lua in Coding at Pearls Valley Academy — The language behind Roblox’s Luau.
Each lesson starts with a short narrated, animated explanation, then hands-on practice. A wrong answer gets a gentle hint, never a penalty, and children earn stars and pearls as they go.