(module main)

(fn count_to ((limit i32)) -> i32
  (var i i32 0)
  (while (< i limit)
    (set i (+ i 1)))
  i)

(test "while counts"
  (var i i32 0)
  (while (< i 3)
    (set i (+ i 1)))
  (= i 3))

(test "while false skips"
  (var i i32 0)
  (while false
    (set i (+ i 1)))
  (= i 0))

(fn main () -> i32
  (count_to 4))
