kota's memex

Arrays in rust have a fixed length and all elements must be of the same type. They are useful when you would like your data allocated on the stack rather than the heap. For a resizable array see: rust vectors

fn main() {
  let a = [1, 2, 3, 4, 5];
  let b: [i32; 5] = [1, 2, 3, 4, 5];
}

initialized

You can also initialize an array to contain the same value for each element by specifying the initial value, followed by a semicolon, and then the length of the array in square brackets, as shown here:

let a = [3; 5];
// a = [3, 3, 3, 3, 3];

panic!

Like other languages rust WILL PANIC if you access an array index out of bounds.

slice

A view into your array. NOT a resizeable array.