Skip to content

Functions

C272 edited this page Jun 30, 2019 · 7 revisions

Algo is a function-oriented language, so functions are extremely flexible, and can be passed around like any other variable, and called as delegate that way. To define a function, you can do the following:

let f(x) = {
    print "You passed in '" + x + "'!";
}

This defines a function with one parameter, x, which can then be mutated and used within the function. In this case, it prints whatever was passed in back to the user! To add more parameters, you simply add a comma, and then another name. They can't be duplicate, so don't use x twice.

let f(x, y) = {
    ...
}

Standard Library Documentation:

Clone this wiki locally