While studying for the C# certification test number 70-483 I was shocked that in C# it is possible to write an empty statement. Perhaps you might think that this is a simple non-important thing. ALLOW ME TO DISAGREE ... during a certification exam you might feel a little bit over confident with your knowledge and overlook the little and small details. So, if you look a question that includes the following code you might believe in a classical Akbarian way that this "It's a trap!"
// empty statement
void SomeFunction()
{
while(DoSomething())
;
}
The semi-colon beneath the while body is an empty statement. It is a simple way of telling the compiler that nothing will happen there. It is a valid C# construct and IT WILL COMPILE. Don't be tricked!
The most common variation of the previous code is:
// empty statement
void SomeFunction()
{
while(DoSomething())
{
}
}





