-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
Andrew Matthews edited this page Aug 14, 2025
·
3 revisions
Short, copyable snippets that mirror what’s covered by tests today.
- main(): string { return "hello"; }
- main(): int { return 3 + 7; }
- main(): float { return 3 / 2; } // division promotes to float
- foo(i: int): string {
- if (i <= 15) { return "child"; }
- else { return "adult"; }
- }
- a: int;
- a: int = 5;
- a = a * 6;
- foo(i: int): string { return "child"; }
- foo(s: string): string { return s; }
- xs: int[] = [1, 2, 3];
- ys: int[] = [x * 2 for x in xs];
- while (i < 10) {
- i = i + 1;
- }
- p.Weight = p.Weight + 1;
calculate_bmi(p: Person {
name: Name,
vitals: Vitals{
age: Age,
height: Height,
weight: Weight
}
}) : float {
return weight / (height * height);
}
See Recursive Destructuring for more.
Note: Syntax is under active development; consult Language Guide and repository tests for latest details.