title: 'If' statement inside the 'for' loop
body: <p>In the following Objective-C code, when first inner 'if' statement is satisfied (true), does that mean the loop terminates and go to the next statement?</p>
  
  <p>Also, when it returns to the inner 'for' statement after executing once, does the value of p is again 2, why?</p>
  
  <pre><code>// Program to generate a table of prime numbers
  
  #import &lt;Foundation/Foundation.h&gt;
  
  int main (int argc, char *argv[])
  {
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  
     int p, d, isPrime;
  
     for ( p = 2; p &lt;= 50; ++p ) {
         isPrime = 1;
  
         for ( d = 2; d &lt; p; ++d )
              if (p % d == 0)
                  isPrime = 0;
  
         if ( isPrime != 0 )
             NSLog (@”%i ", p);
   }
  
   [pool drain];
   return 0;
  }
  </code></pre>
  
  <p>Thanks in advance.</p>