Atom

Function signatures

Declare a named function

Give an operation a name when you want to use it again. A function signature lists the inputs a call can supply.

Atom
func square(value):
    return value * value

print(square(4))
Output
16

A call to square passes 4 into value and receives 16.

Named functions

Use 'func' and a name when other statements will call the function by that name.

Anonymous functions

A function without a name is a value. Assign it to a binding or pass it as an argument.

Functions are first-class. A function signature can have trailing defaults and a final variadic parameter written as ...name. Call frames initialize arguments before evaluating defaults in declaration order. A variadic parameter receives an array. A function that reaches the end returns null.