-
Notifications
You must be signed in to change notification settings - Fork 0
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) = {
...
}
Algo (c) Larry Tang, 2019.
Commercial use of Algo must include the LICENSE file in the same directory as the executable.
Standard Library Documentation: