The body of a loop can be empty : for : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » for »

 

The body of a loop can be empty









    

/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// The body of a loop can be empty. 
 
using System; 
 
public class Empty3 {   
  public static void Main() { 
    int i; 
    int sum = 0; 
 
    // sum the numbers through 5  
    for(i = 1; i <= 5; sum += i++) ; 
 
    Console.WriteLine("Sum is " + sum); 
  }   
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» for