function simple()
local sum = 0
# add 0 to 9
for i in 10
sum += i
end
sum == 45
end
function nests()
local sum = 0
# 5 times
for i in 5
# add 0 to 9
for j in 10
sum += j
end
end
sum == 225
end
function break_loop()
local sum = 0
# 10 times
for i in 10
# add 0 to 9
for j in 10
sum += j
end
if i >= 4
break
end
end
sum == 225
end
function array()
local sum = 0
local values = [ 1, 3, 5, 7 ]
for value in values
sum += value
end
sum == 16
end
model TestModel
a
b
c
end
function for_model()
local test = TestModel(3, 4, 5)
local key_combine = ""
local sum = 0
for key in test
key_combine += key
sum += test[key]
end
key_combine == "abc" and sum == 12
end