Help with while loops!

I've been reading a lot of example programs and i sometimes see:
[code]
while ( x )
while ( !x )
if ( x )
if ( !x )
[/code]
What does that mean? I'm only used to seeing things like:
[code]
while ( x = y )
while ( x != y)
if ( x = y )
if ( x != y )
[/code]
Plus all the greater than, less than, etc.

Thanks.

Comments

  • Lets say TRUE=1 and FALSE=0:

    [code]
    while ( x )
    [/code]
    while (x!=FALSE) or while (x==TRUE)

    [code]
    while ( !x )
    [/code]
    while (x==FALSE) or while (x != TRUE)

    [code]
    if ( !x )
    [/code]
    if (x==FALSE) or if (x != TRUE)

    [code]
    if ( x )
    [/code]
    if (x!=FALSE) or if (x == TRUE)

    Its simply a short hand way of typing logical expressions.

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion