GALLERY
Aera, in small pieces.
Each example shows how Aera works in practice.
main.aera
fn main() { println("Hello world!")}1
Main function
In Aera, the main function represents the entry point for code execution.
sum.aera
fn sum(a: int64, b: int64) -> int64 { a + b}2
Sum of two numbers
Functions are defined with the fn keyword. Type annotations, including the return type are optional.
choose.aera
let hour = 18 let greeting = if hour < 17 { "good day"} else { "good evening"}3
Choosing with if
if is an expression, meaning it produces a value you can bind to with the let keyword.
rec.aera
fn factorial(n: int32) -> int32 { if n <= 1 { 1 } else { n * factorial(n - 1) } }4
Recursion
Aera supports recursion, allowing functions to call themselves.