Loop condition can be any bool expression : for : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » for »

 

Loop condition can be any bool expression








    

/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Loop condition can be any bool expression. 
using System; 
 
public class forDemo {    
  public static void Main() {    
    int i, j; 
    bool done = false; 
 
    for(i=0, j=100; !done; i++, j--) { 
 
      if(i*i >= j) done = true; 
 
      Console.WriteLine("i, j: " + i + " " + j); 
    } 
 
  }    
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» for