mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
153 lines
1.7 KiB
Plaintext
153 lines
1.7 KiB
Plaintext
|
|
|
|
x = -> print what
|
|
|
|
|
|
->
|
|
|
|
-> -> ->
|
|
go to the barn
|
|
|
|
open -> the -> door
|
|
|
|
open ->
|
|
the door
|
|
hello = ->
|
|
my func
|
|
|
|
h = -> hi
|
|
|
|
eat ->, world
|
|
|
|
a = 1 + 2* 3 / 6
|
|
|
|
a, bunch, go, here = another, world
|
|
|
|
func arg1, arg2, another, arg3
|
|
|
|
here, we = () ->, yeah
|
|
the, different = () -> approach; yeah
|
|
|
|
dad()
|
|
dad(lord)
|
|
hello(one,two)()
|
|
(5 + 5)(world)
|
|
|
|
fun(a)(b)
|
|
|
|
fun(a) b
|
|
|
|
fun(a) b, bad hello
|
|
|
|
hello world what are you doing here
|
|
|
|
|
|
what(the)[3243] world, yeck heck
|
|
|
|
hairy[hands][are](gross) okay okay[world]
|
|
|
|
(get[something] + 5)[years]
|
|
|
|
i,x = 200, 300
|
|
|
|
yeah = (1 + 5) * 3
|
|
yeah = ((1+5)*3)/2
|
|
yeah = ((1+5)*3)/2 + i % 100
|
|
|
|
whoa = (1+2) * (3+4) * (4+5)
|
|
|
|
|
|
(->)()
|
|
|
|
|
|
return 5 + () -> 4 + 2
|
|
|
|
return 5 + (() -> 4) + 2
|
|
|
|
print 5 + () ->
|
|
34
|
|
good nads
|
|
|
|
|
|
something 'else', "ya"
|
|
|
|
something'else'
|
|
something"else"
|
|
|
|
here(we)"go"[12123]
|
|
|
|
-- this runs
|
|
something =
|
|
test: 12323
|
|
what: -> print "hello world"
|
|
|
|
print something.test
|
|
|
|
frick = hello: "world"
|
|
|
|
argon =
|
|
num: 100
|
|
world: (self) ->
|
|
print self.num
|
|
return {
|
|
something: -> print "hi from something"
|
|
}
|
|
somethin: (self, str) ->
|
|
print "string is", str
|
|
return world: (a,b) -> print "sum", a + b
|
|
|
|
something.what()
|
|
argon:world().something()
|
|
|
|
argon:somethin"200".world(1,2)
|
|
|
|
x = -434
|
|
|
|
x = -hello world one two
|
|
|
|
hi = -"herfef"
|
|
|
|
x = -[x for x in x]
|
|
|
|
print "hello" if cool
|
|
|
|
print "nutjob"
|
|
|
|
if hello then 343
|
|
|
|
print "what" if cool else whack
|
|
|
|
arg = {...}
|
|
|
|
x = (...) ->
|
|
dump {...}
|
|
|
|
|
|
x = not true
|
|
|
|
y = not(5+5)
|
|
|
|
|
|
y = #"hello"
|
|
|
|
x = #{#{},#{1},#{1,2}}
|
|
|
|
hello, world
|
|
|
|
something:hello(what) a,b
|
|
something:hello what
|
|
something.hello:world a,b
|
|
something.hello:world(1,2,3) a,b
|
|
|
|
x = 1232
|
|
x += 10 + 3
|
|
j -= "hello"
|
|
y *= 2
|
|
y /= 100
|
|
m %= 2
|
|
|
|
|
|
x = 0
|
|
(if ntype(v) == "fndef" then x += 1) for v in *values
|
|
|