title: Ruby, Recursion Method
body: <p>I have a method that is basically a loop and it calls itself at the end each time. What is the best way for the method to not call itself when the date reaches a certain point? Each iteration through adds 1 day and basically processes stats for that day. It looks like the below:</p>
  
  <pre><code>def loop(start_day)
    date = start_day
  
    #do a bunch of stuff
  
    date = date +1.day
  
    if date &gt; Time.now
      puts "loop should be over"
    end
  
    loop(date)
  end
  </code></pre>