mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
24 lines
No EOL
314 B
CoffeeScript
24 lines
No EOL
314 B
CoffeeScript
results: [1, 2, 3].map (x) ->
|
|
x * x
|
|
|
|
ok results.join(' ') is '1 4 9', 'basic block syntax'
|
|
|
|
|
|
# Chained blocks, with proper indentation levels:
|
|
results: []
|
|
|
|
counter: {
|
|
tick: (func) ->
|
|
results.push func()
|
|
this
|
|
}
|
|
|
|
counter
|
|
.tick ->
|
|
3
|
|
.tick ->
|
|
2
|
|
.tick ->
|
|
1
|
|
|
|
ok results.join(' ') is '3 2 1' |