I am kinda confused and I had to ask this. In a statement like
The statements in the body of the while will NOT execute when any of the conditions is not true, right? Thanks and sorryCode:while((x <= 10) && (y > 8) && (z != 0)) do something
I am kinda confused and I had to ask this. In a statement like
The statements in the body of the while will NOT execute when any of the conditions is not true, right? Thanks and sorryCode:while((x <= 10) && (y > 8) && (z != 0)) do something
How about writing a test case and finding out for yourself?
Code:x = 11, y = 7, z = 1; if( (x <= 10) && (y > 8) && (z != 0) ) printf("Is this what you expect?\n");
Quzah.
Hope is the first step on the road to disappointment.
why not just try it?
... and yes, when they are not true, and perhaps even if they arn't not false.
yes, in a test condition , if we are checking for an AND operation
if any condition gives false , the compiler won't check for any
other condition and we will come out of the loop immediately.
Similarly for an OR operation if any condition gives true , the
compiler won't check for any of the remaining condition and will
perform the required function
Rajat kochhar
a quick and important note:
the cicle only break when the expression is evaluated, which happens at the beginning of every cicle.
if somehow some of the variables on the expression change it's value, the cicle won't break, it'll continue normally until it restarts and re-avaluates the expression
What's a cicle?
>What's a cicle?
cycle, where I believe cycle equates to loop.