📜  rust lang make array - Rust 代码示例

📅  最后修改于: 2022-03-11 14:49:25.235000             🧑  作者: Mango

代码示例1
let mut array: [i32; 3] = [0; 3];

array[1] = 1;
array[2] = 2;

assert_eq!([1, 2], &array[1..]);

// This loop prints: 0 1 2
for x in &array {
    print!("{} ", x);
}