greet = (name = "Guest") ->
console.log "Hello, #{name}"
sum = (nums...) ->
total = 0
for n in nums
total += n
total
nums...
は任意の数の引数を配列として受け取る
showUser = ({name, age}) ->
console.log "#{name} is #{age} years old"
hello = (str = "World") ->
console.log("Hello, #{str}")
hello()
hello('User')
addAll = (nums...) ->
sum = 0
for i in nums
sum += i
console.log sum
addAll 1, 2, 3
bookInfo = ({title, author}) ->
console.log "title: #{title} author: #{author}"
book = {title: "Story", author: "John Smith"}
bookInfo(book)