navid/haze / a23ce05222314a23cbee0f97752ef1a1aa9c94af4a3ea4b068cde58edf373fc1 / samples/baseline_2.4/shadowing_gauntlet.hz

shadowing_gauntlet.hz

← samples/baseline_2.4 · 570 bytes · raw · download

const LIMIT i32 = 10
const n i32 = 100
const v i32 = 99
const i i32 = 42

type Box = | Empty | Full(v i32)

pure fn keep(n i32) i32 {
    const x = n
    {
        const x = 1000
    }
    return x
}

fn below_limit(n i32) i32
    : pre n < LIMIT
    => n

fn main() {
    const n = 3
    {
        const n = 9
        print(below_limit(n))
    }
    print(below_limit(n))
    print(keep(7))

    for i in 0..3
        : invariant i <= 3
    {
        print(i)
    }

    const box = Full(5)
    match box {
        Full(v) => print(v)
        Empty => print(0)
    }
}