windjammer 0.48.0

A simple language inspired by Go, Ruby, and Elixir that transpiles to Rust - 80% of Rust's power with 20% of the complexity
Documentation
// Test: Patterns in For Loop Bindings
// Tests that destructuring patterns work in for loops

// ============================================================================
// TEST 1: Tuple destructuring in for loops
// ============================================================================

fn test_tuple_iteration() -> i32 {
    let pairs = vec![(1, 2), (3, 4), (5, 6)]
    
    let mut sum = 0
    for (a, b) in pairs {
        sum = sum + a + b
    }
    
    return sum
}

// ============================================================================
// TEST 2: Struct destructuring in for loops
// ============================================================================

struct Point {
    x: i32,
    y: i32,
}

fn test_struct_iteration() -> i32 {
    let points = vec![
        Point { x: 1, y: 2 },
        Point { x: 3, y: 4 },
        Point { x: 5, y: 6 },
    ]
    
    let mut sum = 0
    for Point { x, y } in points {
        sum = sum + x + y
    }
    
    return sum
}

// ============================================================================
// TEST 3: Wildcard in for loops
// ============================================================================

fn test_wildcard_iteration() -> i32 {
    let pairs = vec![(1, 100), (2, 200), (3, 300)]
    
    let mut sum = 0
    for (a, _) in pairs {
        sum = sum + a
    }
    
    return sum
}

// ============================================================================
// TEST 4: Nested patterns in for loops
// ============================================================================

fn test_nested_iteration() -> i32 {
    let nested = vec![((1, 2), (3, 4)), ((5, 6), (7, 8))]
    
    let mut sum = 0
    for ((a, b), (c, d)) in nested {
        sum = sum + a + b + c + d
    }
    
    return sum
}

// ============================================================================
// MAIN
// ============================================================================

fn main() {
    let r1 = test_tuple_iteration()
    let r2 = test_struct_iteration()
    let r3 = test_wildcard_iteration()
    let r4 = test_nested_iteration()
    
    println("All for loop pattern tests passed!")
}