Looping Tables: pairs & ipairs: Coding lesson for kids
In “Looping Tables: pairs & ipairs”, children learn about for i, fruit in ipairs(fruits) do print(fruit) end; for key, value in pairs(pet) do print(key, value) end.
for i, fruit in ipairs(fruits) do print(fruit) end: ipairs loops over a LIST-style table in order, giving both the index and the value.
for key, value in pairs(pet) do print(key, value) end: pairs loops over ANY table, list or dictionary-style, giving both the key and the value.
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.