2010-01-26 10:52:05 -05:00
|
|
|
a: [(x) -> x, (x) -> x * x]
|
2009-12-30 18:09:43 -05:00
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok a.length is 2
|
2010-01-01 09:49:18 -05:00
|
|
|
|
|
|
|
|
|
|
|
regex: /match/i
|
|
|
|
words: "I think there is a match in here."
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok !!words.match(regex)
|
2010-01-01 10:17:33 -05:00
|
|
|
|
|
|
|
|
|
|
|
neg: (3 -4)
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok neg is -1
|
2010-01-06 21:21:42 -05:00
|
|
|
|
|
|
|
|
2010-01-26 10:52:05 -05:00
|
|
|
func: ->
|
2010-01-06 21:21:42 -05:00
|
|
|
return if true
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok func() is null
|
2010-01-06 23:15:13 -05:00
|
|
|
|
|
|
|
|
|
|
|
str: "\\"
|
|
|
|
reg: /\\/
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok reg(str) and str is '\\'
|
2010-01-09 11:58:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
i: 10
|
|
|
|
while i -= 1
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok i is 0
|
2010-01-10 15:52:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
money$: 'dollars'
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok money$ is 'dollars'
|
2010-02-02 20:36:46 -05:00
|
|
|
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok {a: (num) -> num is 10 }.a 10
|
2010-02-15 19:13:08 -05:00
|
|
|
|
|
|
|
|
2010-02-02 20:36:46 -05:00
|
|
|
bob: {
|
|
|
|
name: 'Bob'
|
|
|
|
greet: (salutation) ->
|
|
|
|
salutation + " " + @name
|
|
|
|
hello: ->
|
2010-02-02 20:44:10 -05:00
|
|
|
@greet "Hello"
|
2010-02-08 11:48:43 -05:00
|
|
|
10: 'number'
|
2010-02-02 20:36:46 -05:00
|
|
|
}
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok bob.hello() is "Hello Bob"
|
|
|
|
ok bob[10] is 'number'
|
2010-02-16 08:43:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
obj: {
|
|
|
|
'is': -> yes
|
|
|
|
'not': -> no
|
|
|
|
}
|
|
|
|
|
2010-02-16 19:45:25 -05:00
|
|
|
ok obj.is()
|
|
|
|
ok not obj.not()
|