Hopper
Arrays and structs

Arrays

A fixed-size array holds a known number of values of one type.

src/main.hop
fn main() -> i32 {
    let items = [3]i32{10, 20, 12};
    let index = 2;
    return items[0] + items[1] + items[index];
}
terminal

hopper run demo src

The example has three i32 elements. Indexing starts at zero, and Hopper checks a runtime index before access. Array element types can themselves be arrays or structs.