moonscript/tests/outputs/loops.lua
2012-08-12 00:58:35 -07:00

145 lines
2.3 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
local _list_0 = something
for _index_0 = 1, #_list_0 do
local x = _list_0[_index_0]
print(x)
end
for k, v in pairs(hello) do
print(k, v)
end
for x in y,z do
print(x)
end
for x in y,z,k do
print(x)
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 = { }
local _len_0 = 0
local _list_1 = hello
for _index_0 = 1, #_list_1 do
local y = _list_1[_index_0]
local _value_0
if y % 2 == 0 then
_value_0 = y
end
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
end
end
return _accum_0
end)()
x = function()
local _list_1 = hello
for _index_0 = 1, #_list_1 do
x = _list_1[_index_0]
local _ = y
end
end
local t = (function()
local _accum_0 = { }
local _len_0 = 0
for i = 10, 20 do
local _value_0 = i * 2
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
end
end
return _accum_0
end)()
local hmm = 0
local y = (function()
local _accum_0 = { }
local _len_0 = 0
for j = 3, 30, 8 do
hmm = hmm + 1
local _value_0 = j * hmm
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_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 = { }
local _len_0 = 0
for k = 10, 40 do
local _value_0 = "okay"
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_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 = { }
local _len_0 = 0
while i < 10 do
i = i + 1
local _value_0 = i
if _value_0 ~= nil then
_len_0 = _len_0 + 1
_accum_0[_len_0] = _value_0
end
end
return _accum_0
end)()