Using break to exit a do-while loop : While : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » While »

 

Using break to exit a do-while loop









    

/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Using break to exit a do-while loop.   
 
using System; 
 
public class BreakDemo2 {  
  public static void Main() {  
    int i; 
 
    i = -10;     
    do { 
      if(i > 0) break; 
      Console.Write(i + " "); 
      i++; 
    } while(i <= 10); 
  
    Console.WriteLine("Done");  
  }  
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» While