title: Remove an element while iterationg over it
body: <p>Is there a way to remove an element while iterationg over it? Here is a code example:</p>
  
  <pre><code>for particle in &amp;mut particles {
  
      let mut delete = false;
      // Do stuff...
  
      if delete {
          // Remove element from particles vector &lt;-- THIS
      }
  
  }
  </code></pre>
  
  <p>I think it's not possible with this <em>(dirty)</em> design. What's the common (elegant?) pattern to remove some elements in a vector assuming I need to iterate in order to know what element I need to remove? Feel free to close if duplicate.</p>