Loops repeat a block while a counter changes.

Loops

loops.lua
local limit = 
local total = 0

for number = 1, limit do
  total = total + number
end

print("limit=" .. limit)
print("total=" .. total)
local limit = 
local total = 0

for number = 1, limit do
  total = total + number
end

print("limit=" .. limit)
print("total=" .. total)
local limit = 
local total = 0

for number = 1, limit do
  total = total + number
end

print("limit=" .. limit)
print("total=" .. total)
for loop A numeric `for` loop visits each number from the start value through the end value.