Leave the body of a loop to be empty in CSharp
Description
The following code shows how to leave the body of a loop to be empty.
Example
//from w ww .j a v a2 s .c o m
using System;
public class MainClass {
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);
}
}
The code above generates the following result.