Skip to content
← Index | Lesson 1 of 5

Basic Functions

Functions in Zolo

Functions are declared with fn:

fn greet(name: str) -> str {
    return "Hello, {name}!"
}

print(greet("Alice"))

The return type is indicated with ->. The last value in a function can also be returned implicitly.

Goal: Create a function square that returns the square of a number and print square(7).

lesson-2-1.zolo
Program output

Run the code to see the output

Search Zolo

9 results

enespt-br