// LANG-COMP-010-02: Closure Captures
// Demonstrates capturing variables from outer scope

fn main() {
    // Capture outer variable by value
    let x = 10
    let add_x = |y| { x + y }
    println(add_x(5))

    // Capture multiple variables
    let a = 2
    let b = 3
    let calculate = |n| { n * a + b }
    println(calculate(5))

    // Function returning closure
    fn make_adder(n) {
        |x| { x + n }
    }

    let add_five = make_adder(5)
    println(add_five(10))
}
