Multiple Return Values: Coding lesson for kids
In “Multiple Return Values”, children learn about function minMax(a, b) if a < b then return a, b end return b, a end; local lo, hi = minMax(9, 3).
function minMax(a, b) if a < b then return a, b end return b, a end: A Lua function can return MORE THAN ONE value at once — separated by commas.
local lo, hi = minMax(9, 3): Catches both returned values into two separate variables at once.
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.