Mega Code Archive

 
Categories / C# / Language Basics
 

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);    }    }