fn main() {
    // Test 1: let inside if should update outer scope
    let x = 10
    if true {
        let x = 20
    }
    println("Test 1 (expect 20): " + x)

    // Test 2: let inside while should persist
    let total = 0
    let i = 0
    while i < 5 {
        let total = total + i
        let i = i + 1
    }
    println("Test 2 (expect 10): " + total)

    // Test 3: reassignment (no let) inside if
    let y = 100
    if true {
        y = 200
    }
    println("Test 3 (expect 200): " + y)

    // Test 4: array_push inside if
    let arr = array_new()
    arr = array_push(arr, "a")
    if true {
        arr = array_push(arr, "b")
    }
    println("Test 4 (expect [a, b]): " + arr)
    println("Test 4 len (expect 2): " + array_len(arr))

    // Test 5: nested if
    let z = 0
    if true {
        if true {
            let z = 999
        }
    }
    println("Test 5 (expect 999): " + z)
}
