title: Understanding Python Functions
body: <p>Currently I have this function:</p>
  
  <pre><code>x = 0
  limit = 10
  y = 7
  def basic(x):
      global y
      while x &lt;= limit:
          if x == 0 or 1:
              y += 1
              basic(x+1)
              return x
          else:
              y += 2
              basic(x+1)
              return x
  
  basic(x)
  print(y)
  </code></pre>
  
  <p>When I print y it returns 18 which means that it is stuck in the if statement and would not go to the else statement but x does stop at the limit hence y = 18. I looked up various sources online but I cannot get an exact clear visualization of my problem. </p>