Arrays in Rust

Share this video with your friends

Send Tweet

In this lesson we take a look at Arrays and the different ways of creating them. Arrays in Rust are collections of values of the same type that cannot change in size. In other words, the number of fields (or elements) has to be known at compile time.

J. Matthew
J. Matthew
~ 5 years ago

for number in &numbers {

Why did you use a reference to the array?

When I try it without the ampersand, I get a compile error that the array is not an iterator.

Pascal Precht
Pascal Precht(instructor)
~ 5 years ago

This needs a blog post. I'll put one together and post it here once done.

Anthony Albertorio
Anthony Albertorio
~ 4 years ago

Is the blog up? I have the same question.

Pascal Precht
Pascal Precht(instructor)
~ 4 years ago

Hey Anthony,

unfortunately I didn't get to writing it yet. Life happened, ha. But thanks for the reminder!

Rene
Rene
~ 3 years ago

hi Pascal, is the blog finished ? is that &names for leaving the ownership in the array ? or it is for performance ?