Do{ shit(); } while (x != 'y' && x != 'n');

do{ shit(); } while (x != 'y' && x != 'n');


please explain: how can x be not equal to y AND n.
what if x is n then first test fails and assumingly do while should fail and loop again.

>how can x be not equal to y AND n.
Let x be 'p'.
'p' is not 'y', nor is it 'n'.
Therefore x is not 'y', nor is it 'n'.

>what if x is n then first test fails and assumingly do while should fail and loop again.
Well, that's what makes a do/while loop different from a regular loop. The first iteration is executed regardless of whether the condition would be satisfied or not, and during that iteration, things might change that would cause the condition to be satisfied where it was not previously.

The loop will keep going so long as x isn't equal to 'y' or 'n'.
Why is that so hard to understand?

>or
are you blind? && is and.
to me it makes more sense to have || instead of && in there.

ok

The while loop can only continue so long as x IS NOT EQUAL TO 'y' AND x is NOT EQUAL TO 'n'.

Is that hard to understand?

If ||, it won't short circuit if x == 'y'

this can be rewritten as
do{ shit(); } until (x == 'y' || x == 'n');


hopefully this makes things clearer for you

>are you blind? && is and.
I hope you realize that !(A && B) == !A || !B, which is what he basically did, in text.

retard. how can x not be equal to 2 things at once?

>there are literal retards who went to uni to learn formal logic
>this is the result
is there anything more useless?

You're the one retarded if you don't grasp basic logic.

De Morgan's theorem might be a little bit over OP's head

So what you're saying, sir, is that I must either be the President of the United States or the Secretary of State, and cannot in any way be neither?

nvm. fixed it ;)

here's the loop in java just for the sake of being real
while (x != 'y' && x != 'n') {
doShit();
}

So saying x (a variable that can store anything_ equals 'f' the function doShit() will run, if x is equal to 'y' or 'n' the function doShit() will not run.

It's a do while loop, not a while loop.

i can equal 2 things at once, or 12 things at once, or 50,000 at once. BUT so long as its not 'y' or 'n', 'while' will be run. is that hard?

yep the loop can't end

Give up on computer science

do-while runs at least once.

not equal = different
How can something be different to two other things????? Are we living in a world with only two things????????????????

Let me guess, you want to learn web """"programming"""".