moonscript/tests/outputs/loops.lua
2011-07-16 17:14:57 -07:00

135 lines
2.1 KiB
Lua

for x = 1, 10 do
print("yeah")
end
for x = 1, #something do
print("yeah")
end
for y = 100, 60, -3 do
print("count down", y)
end
for a = 1, 10 do
print("okay")
end
for a = 1, 10 do
for b = 2, 43 do
print(a, b)
end
end
for i in iter do
for j in yeah do
local x = 343 + i + j
print(i, j)
end
end
do
local _item_0 = something
for _index_0 = 1, #_item_0 do
local x = _item_0[_index_0]
print(x)
end
end
for k, v in pairs(hello) do
print(k, v)
end
local x
x = function()
for x in y do
local _ = y
end
end
local hello = {
1,
2,
3,
4,
5
}
x = (function()
local _accum_0 = { }
do
local _item_0 = hello
for _index_0 = 1, #_item_0 do
local y = _item_0[_index_0]
local _value_0
if y % 2 == 0 then
_value_0 = y
end
if _value_0 ~= nil then
table.insert(_accum_0, _value_0)
end
end
end
return _accum_0
end)()
x = function()
do
local _item_0 = hello
for _index_0 = 1, #_item_0 do
local x = _item_0[_index_0]
local _ = y
end
end
end
local t = (function()
local _accum_0 = { }
for i = 10, 20 do
local _value_0 = i * 2
if _value_0 ~= nil then
table.insert(_accum_0, _value_0)
end
end
return _accum_0
end)()
local hmm = 0
local y = (function()
local _accum_0 = { }
for j = 3, 30, 8 do
hmm = hmm + 1
local _value_0 = j * hmm
if _value_0 ~= nil then
table.insert(_accum_0, _value_0)
end
end
return _accum_0
end)()
local _
_ = function()
for k = 10, 40 do
_ = "okay"
end
end
_ = function()
return (function()
local _accum_0 = { }
for k = 10, 40 do
local _value_0 = "okay"
if _value_0 ~= nil then
table.insert(_accum_0, _value_0)
end
end
return _accum_0
end)()
end
while true do
print("name")
end
while 5 + 5 do
print("okay world")
working(man)
end
while also do
i(work(too))
_ = "okay"
end
local i = 0
x = (function()
local _accum_0 = { }
while i < 10 do
i = i + 1
local _value_0 = i
if _value_0 ~= nil then
table.insert(_accum_0, _value_0)
end
end
return _accum_0
end)()