Skip to content

Instantly share code, notes, and snippets.

@dvv
Created January 14, 2012 08:01
Show Gist options
  • Save dvv/1610685 to your computer and use it in GitHub Desktop.
Save dvv/1610685 to your computer and use it in GitHub Desktop.
MoonScript + CoffeeScript syntax
is, isnt
====
is, isnt ---> ==, ~=
else if
====
if 1
p(1)
else if 2
p(2)
if 1 then
p(1)
elseif 2 then
p(2)
end
for of
====
for k, v of o
stat
end
for k, v in pairs(o) do
stat
end
for own of
====
for own k, v of o
stat
end
for k, v in pairs(o) do if rawget(o, k) ~= nil then
stat
end end
for in
====
for i in {1, 2, 3}
f(i)
for _, i in ipairs({1,2,3}) do
f(i)
end
allow [] for array-like tables
====
foo = [1,2,3]
local foo = {1,2,3}
continue
====
mimick via new goto
allow # as comment sign
====
# comment here
#comment here
-- comment here
#comment(here)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment