Files
coffeescript/test/fixtures/execution/test_arguments.coffee
2010-01-29 23:30:54 -05:00

33 lines
432 B
CoffeeScript

area: (x, y, x1, y1) ->
(x - x1) * (x - y1)
x: y: 10
x1: y1: 20
puts area(x, y, x1, y1) is 100
puts(area(x, y,
x1, y1) is 100)
puts(area(
x
y
x1
y1
) is 100)
# Arguments are turned into arrays.
curried: ->
puts area.apply(this, arguments.concat(20, 20)) is 100
curried 10, 10
# Arguments is not a special keyword -- it can be assigned to:
func: ->
arguments: 25
arguments
puts func(100) is 25