### while loop - 2 conditions with OR

hi guyz, i have a problem with a while/do while loop, and i'm not certant is it really a problem or i just dont know the rule about using it.
For instance, is it possible to use 2 or more conditions in while loop using ||(or) operator?

int a = 2;
int b = 2;

while(a != 1 || b != 1)
{
do something
a = 1;
}

it doesn't end, it continuesly loops

any thoughts?

Much abliged

Yeah offcourse...

"or" means that if one condition is still true then the whole condition is true

You need to have it false in both condition

so if you set a to 1 and b is still not 1 then it will still loop
This is because the while condition resolves like this:

if a IS NOT equal to 1
or if b is NOT equal to 1

This means that to terminate that loop, a must equal 1 and b must equal 1. You might want to try using the (and) && operator. For example...

while(a != 1 && b != 1)

Means that a AND b must not equal one for the expression to be true.
the correct syntax for a do-while loop is
do
{