for Loops: Coding lesson for kids
In this lesson, children learn to write a numeric for loop and state what its three parts control.
for i=1,4 do: i starts at 1 and counts up to 4 — because YOU wrote 1 as the start. You can write any start value; the loop does not force 1.
for i=0,2 do: This starts at 0, giving 0, 1, 2 — the start is whatever number you choose.
print(i): Runs once per loop — prints each value of i in order.
end: Closes the for loop.
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.