I want to do a while loop with a boolean kind of like in python.
I want something like:
while(player1_health > 0 or player2_health > 0){
//code
}
I want to do a while loop with a boolean kind of like in python.
I want something like:
while(player1_health > 0 or player2_health > 0){
//code
}
There is no or
operator in C
, In C
we use symbol ||
, called as logical OR operator.
Use This
while( (player1_health > 0) || (player2_health > 0) ) {
//code
}
Update: Looks like C99
includes or
, and
for operators ||
, &&
, if you are using C99
it works with the inclusion of header file #include <iso646.h>