Welcome to the Treehouse Community
Looking to learn something new?
Grigor Samvelian2,852 Points
conditional-or operator question
Hi, in the teachers notes of the video Methods | C# Objects its stated in the truth table of the conditional-or operator that if x is false and y is true the result would be true, but from my understanding of the conditional-or operator that the answer should be false because x is false and x is evaluated first. Could someone please explain to me why the result would be true, thank you!
Tsenko Aleksiev3,819 Points
AND - both sides of the operator must be true in order the result to be true. If only one side is false, than the result is false. OR - it needs only one side if the operator, no matter which one, to be true in order the result to be true. If both are false, only than the result is going to be false. Think of it: Bodyguard at the entrance of a disco: he only passes if you are a boy AND you have 18. The next day he passes only if you have 18 OR you a dressed as a cloun. Got it?