// module loop_sum_to_run

/// loop-recur iter 3 — sum 1..10 via loop/recur. Expected stdout: 55.
fn main() -> own Unit with IO {
  print(sum_to(10))
}

fn sum_to(n: own Int) -> own Int {
  loop(acc = 0, i = 1) {
    if gt(i, n) {
      acc
    } else {
      recur(acc + i, i + 1)
    }
  }
}
