coffeescript

Functions

Small Arrow functions

# creates a function with no arguments, which returns 3
get_three = () -> 
    return 3

# same as above
get_three = -> 3

# creates a function with arguments
add_three = (num) -> num + 3

# multiple arguments, etc.
add = (a, b) -> a + b

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow