# What are empty conditions

• 09-17-2010
FLaTLiN3D
What are empty conditions
I've looked around and I cannot seem to figure out what exactly this statement means: "However, an empty condition is not legal for a while loop as it is with a for loop."

I've even tried reading through a while and for statements section in a Java book to see if it would have a better explanation, no dice. Help is appreciated.

At first I thought it was something like "while ();" or "for ();". But neither of those were accepted in my compiler.

FLaTLiN3D
• 09-17-2010
laserlight
Basically, this is legal:
Code:

```unsigned int i; for (i = 0;; ++i);```
But this is not:
Code:

`while ();`
• 09-17-2010
FLaTLiN3D
Quote:

Originally Posted by laserlight
Basically, this is legal:
Code:

```unsigned int i; for (i = 0;; ++i);```
But this is not:
Code:

`while ();`

How is the first one an empty condition though?
• 09-17-2010
laserlight
Quote:

Originally Posted by FLaTLiN3D
How is the first one an empty condition though?

Well, how many times will that for loop loop?
• 09-17-2010
FLaTLiN3D
Quote:

Originally Posted by laserlight
Well, how many times will that for loop loop?

Ehh... None? Because "i" can't be 0 and still be increasing by one, correct?
I'm just getting started with C, and I'm not familiar with the double semi-colon that you used, what precisely does that to?
• 09-17-2010
laserlight
Quote:

Originally Posted by FLaTLiN3D
I'm not familiar with the double semi-colon that you used, what precisely does that to?

Well, suppose I wrote this:
Code:

`for (i = 0; i < 10; ++i);`
Looks more familiar? Now, remove the " i < 10". What do you get?

So, that is the part that is the condition.
• 09-17-2010
Salem
The forever loop is typically written as
Code:

```for ( ; ; ) {   // always }```