-4

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
}
1cubealot
  • 5
  • 2

1 Answers1

3

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>

IrAM
  • 1,720
  • 5
  • 18