Computer Science Canada Or not equal too question. |
Author: | thegadgetman [ Fri Nov 26, 2010 11:14 am ] | ||
Post subject: | Or not equal too question. | ||
I am having an issue with my While statement when asking user if they want to loop the program or not. Even if I put the correct response "Y" or "N" it still loops through the error check, I am assuming my logical OR statement is the cause but I am not sure how to fix it.
|
Author: | jcollins1991 [ Fri Nov 26, 2010 12:17 pm ] |
Post subject: | Re: Or not equal too question. |
Because you're looping both when it's neither of the two (or statements evaluates !F | !F, so T | T), and when one of them is true (or statement evaluates !T | !F, so T | F). What you want is either (!A & !B) or (!(A | B)). |
Author: | thegadgetman [ Sat Nov 27, 2010 12:33 pm ] |
Post subject: | Re: Or not equal too question. |
Okay I see why now. Thank you for taking the time to explain it to me and not just give me the answer. |