title: How to swap two variables?
body: <p>What is the closest equivalent Rust code to this Python code?</p>
  
  <pre><code>a, b = 1, 2
  a, b = b, a + b
  </code></pre>
  
  <p>I am trying to write an iterative Fibonacci function. I have Python code I want to convert to Rust. Everything is fine, except for the swap part.</p>
  
  <pre class="lang-py prettyprint-override"><code>def fibonacci(n):
      if n &lt; 2:
          return n
      fibPrev = 1
      fib = 1
      for num in range(2, n):
          fibPrev, fib = fib, fib + fibPrev
      return fib
  </code></pre>