title: How to code recursion in Objective-C with classes?
body: <p>I just started learning Objective-C and OOP ... so I have very stupid question :)
  I wanna understand how to write recursive functions in Objective-C. </p>
  
  <p>I get factorial counting as example. Here is my code )) he-he</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface Factorial : NSObject
  {
      int nFact;
  }
  
  -(int) countFactorial:(int) nFact;
  -(void) printFactorial;
  
  @end //Factorial
  
  @implementation Factorial
  
  -(int) countFactorial:(int) n
  {
      int tmp;
  
      if (n!=0)
      {
          tmp=n*countFactorial(n-1);
      }
      else {
          return(0);
      }
  
      nFact=tmp;
  }
  
  -(void) printFactorial
  {
      NSLog(@"Factorial = %i",nFact);
  }
  
  @end //Factorial
  
  int main (int argc, const char * argv[]) {
      NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  
      id myFact=[Factorial new];
      int qqq=[myFact countFactorial:5];
      [myFact printFactorial];
      [myFact release];
  
      [pool drain];
      return 0;
  }
  </code></pre>
  
  <p>I get error from compiler - that I implicit declare countFactorial function
  and I get error (of course) from linker that it didn't find countFactorial</p>
  
  <p>Plz give my any suggestions how implement recursion in Objective-C
  I want to use it im my next "project" - tic tac toe - to find right move via recursion ) </p>
  
  <p>Thx!</p>