title: VB Recursion and Fibonacci sequence
body: <p>OK. I know this is a classic but I cant seem to find any threads explaining how the trace table would work. My own attempts look like faulty logic. For example this code works great:</p>
  
  <pre><code> Sub Main()
          For i = 1 To 6
              Console.WriteLine(f(i))
          Next
          Console.ReadKey()
   End Sub
  </code></pre>
  
  <p>Then we have the Function:</p>
  
  <pre><code>Function f(n)
          If n &lt;= 1 Then
              Return n
          Else
              n = f(n - 1) + f(n - 2)
              Return n
          End If
      End Function
  </code></pre>
  
  <p>However, my trace table ends up like this:</p>
  
  <pre><code>i  f-1  f-2  n
  1            1
  2   1    0   1
  3   2    1   3
  4   3    2   5
  5   4    3   7
  6   5    4   9
  </code></pre>
  
  <p>Which makes perfect sense to me, but obviously shows I dont have a clue. What is the faulty logic here??</p>