title: How does this recursive function get to this output?
body: <p>When I run this piece of code for n=5 the output I get is "5 3 1 1 3 5"
  I get the 5 3 1 part but after that n=-1 but when I run the code with a debugger it when n=-1 it goes to the line after <code>numbers(n-2);</code>i.e <code>System.out.prt(n+ "");</code> even though that statement is contained in the if block.</p>
  
  <p>Why does this happen? </p>
  
  <pre><code>public void numbers(int n)
  {
      if(n&gt;0)
      {
          System.out.print(n+" ");
          numbers(n-2);
          System.out.print(n+" ");
      }
  }
  </code></pre>
  
  <p>TLDR : when n=-1  <code>System.out.prt(n+ "");</code>even though it is within the if block which only runs when n>0.</p>
  
  <p>Any help would be much appreciated. Thanks in advance! </p>