Line Decorators

For convenience, the for loop and if statement can be applied to single statements at the end of the line:

MoonScript:

print "hello world" if name == "Rob"

Lua:

if name == "Rob" then
  print("hello world")
end

And with basic loops:

MoonScript:

print "item: ", item for item in *items

Lua:

local _list_0 = items
for _index_0 = 1, #_list_0 do
  local item = _list_0[_index_0]
  print("item: ", item)
end

results matching ""

    No results matching ""