bool statment


Hi,
is there any statment to control the both values of bool in just one value. Imean rather to write..
1
2
3
4
bool cont;

if(cont == true && cont == false){//do something}


i want something like that
1
2
3
4
5
bool cont;

if(cont == ?) // ? shoud describe 0 or 1; how can i do that?

{//do something} 


thanks alot..
I don't really understand what you are asking for
If you want to 'do something' when 'cont' is either true or false you don't need a condition as it will always be true.
If you want to 'do something' when 'cont' is both true and false you can just don't type it as it will always be false.
if (true)
This condition will be always executed.
No there's no way. Also, cont can't be true and false at the same time so your statement would never evaluate to true.

To shorten it you can write if (var1 && !var2).
Not sure what you mean about describing 0 or 1.
Perhaps you are looking for something like this?
boost::logic::tribool
http://www.boost.org/doc/libs/1_40_0/doc/html/tribool.html
This reminds me of this: http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx

(cont == true && cont == false)
I don't understand the condition.
Something is either equal to one value or to another value. It can't be equal to both. Booleans in particular are either true or false. They can't be true and false and there's nothing in-between.
The closest thing to what you're asking is, as R0mai said, if (true), but such an if is completely useless.
LOL! XD
Topic archived. No new replies allowed.