title: How do I swap array elements using parallel assignment?
body: <p>I am trying to swap two elements in an array like this</p>
  
  <pre><code>deck = []
  (deck &lt;&lt; (1..52).to_a &lt;&lt; 'A' &lt;&lt; 'B').flatten!
  p deck
  deck[deck.index("A")], deck[deck.index("B")] = deck[deck.index("B")], deck[deck.index("A")] #swap "A" and "B"
  p deck
  </code></pre>
  
  <p>But it doesnt swap. If i do this, however:</p>
  
  <pre><code>deck[52], deck[53] = deck[53], deck[52]
  </code></pre>
  
  <p>it works. Any suggestions?</p>