// Sum loop benchmark - tight numeric loop
fn sumTo(n: Int): Int = {
    sumLoop(n, 0)
}

fn sumLoop(n: Int, acc: Int): Int = {
    if n <= 0 then acc
    else sumLoop(n - 1, acc + n)
}

fn main(): Unit = {
    let result = sumTo(10000000)
    Console.print("Sum to 10M: " + toString(result))
}
