Enter your book access code

The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).

Don’t have the book yet? The landing page stays open — purchase unlocks this gym.

beginner · order 32

Mutate during immutable iteration

borrow-excl-03Related book chapters: 6, 9 (optional — this page is complete on its own)E0502iterator

Slug: borrow-excl-03 · Paired reading: Chapters 6 and 9

Prompt

fn double_evens(v: &mut Vec<i32>) — double every even element in place. You cannot push while iter() is live; mutate via indices or iter_mut.