Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Hmm... There was no exit condition inside the code. I'm trying so hard to remember the question :S Commented Jun 12, 2011 at 14:58
  • 3
    +1 for using "stack overflow" (as well as for a correct answer). Commented Jun 12, 2011 at 14:58
  • 2
    @ted, yeah, i couldn't resist ;) Commented Jun 12, 2011 at 14:59
  • @Mohammad - an "exit condition" is any test in the body of the method that would prevent the recursive call if the condition were met. For instance: int factorial(n) { return n < 2 ? 1 : n * factorial(n-1); } Commented Jun 12, 2011 at 15:01
  • Oh boy! I got this question wrong! how come I've never read it in my book Commented Jun 12, 2011 at 15:02