home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor2.zip / BREAKCON.C < prev    next >
Text File  |  1989-11-10  |  829b  |  37 lines

  1.                                           /* Chapter 3 - Program 5 */
  2. main()
  3. {
  4. int xx;
  5.  
  6.    for(xx = 5;xx < 15;xx = xx + 1){
  7.       if (xx == 8)
  8.          break;
  9.       printf("In the break loop, xx is now %d\n",xx);
  10.    }
  11.  
  12.    for(xx = 5;xx < 15;xx = xx + 1){
  13.       if (xx == 8)
  14.          continue;
  15.       printf("In the continue loop, xx is now %d\n",xx);
  16.    }
  17. }
  18.  
  19.  
  20.  
  21. /* Result of execution
  22.  
  23. In the break loop, xx is now 5
  24. In the break loop, xx is now 6
  25. In the break loop, xx is now 7
  26. In the continue loop, xx is now 5
  27. In the continue loop, xx is now 6
  28. In the continue loop, xx is now 7
  29. In the continue loop, xx is now 9
  30. In the continue loop, xx is now 10
  31. In the continue loop, xx is now 11
  32. In the continue loop, xx is now 12
  33. In the continue loop, xx is now 13
  34. In the continue loop, xx is now 14
  35.  
  36. */
  37.