Lessons

lesson 10 / 15

Custom functions

A custom function is declared with func. Arguments are available as $1, $2, and so on. $0 contains the function name.

kongue
func greet {
    print "hello, $1"
}

main {
    greet "tinkerer"
    greet "builder"
}

Functions help keep repeated operations in one place. They can call other custom functions and use the same built-ins as main.