Beginner Rust
Q32 / 100

What is the difference between iter(), iter_mut(), and into_iter()?

Correct! Well done.

Incorrect.

The correct answer is B) iter() yields &T; iter_mut() yields &mut T; into_iter() consumes the collection yielding T

B

Correct Answer

iter() yields &T; iter_mut() yields &mut T; into_iter() consumes the collection yielding T

Explanation

Use iter() for read-only access, iter_mut() for mutation, into_iter() when you want to consume and transform the collection.

Progress
32/100