Version: v0.7.1 - Beta.  We welcome contributors & feedback.

Function Argument Typing

You can declare the type of each argument passed to a function. Calls that don’t match these types will fail at runtime.

To declare a type, append a type token to the argument with a colon :.

// Take a (n)umber and a (s)tring
fn countItems($num:n, $itemName:s) {
    print('You have ' ~ $num ~ ' ' ~ $itemName)
}

countItems(3, 'tacos')
//= 'You have 3 tacos'

countItems('tacos', 3)
// ✕ ERROR. Arguments are reversed.

Type Tokens 

Token Type
s string
b boolean
n number
l list
m map
o object
fn function
any all types (same as no type at all)

Return Types 

See Also