Continue in while : While : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » While »

 

Continue in while








    

/*
 * C# Programmers Pocket Consultant
 * Author: Gregory S. MacBeth
 * Email: gmacbeth@comporium.net
 * Create Date: June 27, 2003
 * Last Modified Date:
 */
using System;

namespace Client.Chapter_4___Program_Control
{
  public class MyMainClass11
  {
    static void Main(string[] args)
    {
      WhileContinue();
      WhileBreak();
      WhileGoto();
    }
    static void WhileContinue()
    {
      int a = 0;
      
      while(a < 10)
      {
        a++;
        if (a == 5)
        {
          a++;
          continue;
        }
      }

    }
    static void WhileBreak()
    {
      int a = 0;

      while (a < 10)
      {
        a++;
        if (a == 5)
          break;
      }

      a++;
    }
    static void WhileGoto()
    {
      int a = 0;

      while (a < 10)
      {
        if (a == 5)
          goto cleanup;
      }
    cleanup :

      Console.WriteLine(a);
    }
  }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» While