// Phase 200-D: Capture variable used in CONDITION (not just body)
// This test verifies that captured variables can be used in break conditions.
//
// Key points:
// - limit is captured (function-scoped constant)
// - Used in break condition: if v > limit { break }
// - This proves ConditionEnv.captured is properly connected

static box Main {
    main() {
        local limit = 50      // Captured var (used in break condition)

        local i = 0
        local v = 0
        local n = 100         // Loop up to 100 times

        // Pattern 2: loop with break using captured var in condition
        loop(i < n) {
            v = v + 10
            i = i + 1

            // Break condition uses CAPTURED variable 'limit'
            if v > limit {
                break
            }
        }

        // v should be 60 (broke when v=60 > limit=50)
        print(v)  // Expected: 60
    }
}
