Start learning free

LESSON 109 OF 679 · ARRAYS I

Updating static array elements in Rust

Lesson

The entries of an array declared with mut can be changed freely, using indices and the bracket notation:

let mut our_array = [50, 40, 30];
our_array[0] = 15;
our_array[1] = -1;

// our_array is now [15, -1, 30]

Assignment
Follow the Coding Tutorial and let's play with some arrays.


Hint
Look at the examples above if you get stuck.


STEP 1 OF 3
    Ctrl + Enter to check