module IfElse {
// IF/ELSE BASICS
import { /Std/Math; }
fn test() {
// generate pseudorandom int between 0..9
let x = (rand() * 10)::int;
// use if/else for branching
if (x > 5) {
// true
} else {
// false
}
// the else is optional
if (x == 0) {
// true
}
// if/else can be used as an expression
let y = if (x < 6) 1 else 2;
// if the else is not present, then the result is optional, and will be none if the else branch is taken
let z = if (x > 7) "yes"; // the type of z is string? (optional string)
}
}