[4 / 1 / 1]
I have a smooth brain and I'm trying to learn rust for fun. I can't understand how borrowing works.
Say you have a vector x where each element of x is itself a vector.
I want to iterate over every element of x, choose a random other element in x, compare the two, and modify both elements if they satisfy a condition. Is this possible as structured? The compiler complains that x cannot be mutably borrowed twice.
Say you have a vector x where each element of x is itself a vector.
I want to iterate over every element of x, choose a random other element in x, compare the two, and modify both elements if they satisfy a condition. Is this possible as structured? The compiler complains that x cannot be mutably borrowed twice.
