Newbie question, Need help to understand boolean
I am using the tutorial:
Cprogramming.com Tutorial: If Statements
I can't seem to grasp one thing in this tutorial. Maybe I am focusing on the wrong thing or something, but here it is.
At the end of the tutorial it is talking about Boolean operators.
Code:
A. !( 1 || 0 ) ANSWER: 0
B. !( 1 || 1 && 0 ) ANSWER: 0 (AND is evaluated before OR)
C. !( ( 1 || 0 ) && 0 ) ANSWER: 1 (Parenthesis are useful)
How do you get the answers to that?
I am trying to make my question as clear as I can.
How can you take !(1 || 0) and say the answer is 0 ?
Can someone maybe explain it in a different approach or something so that I can understand it?
Maybe how to evaluate that step by step?
I think I know this much:
! = NOT
|| = OR
NOT is evaluated before AND OR
AND = is evaluated before OR
I understand everything in the previous tutorial's. I just feel if I don't grasp this I will have problems understanding future things. I have written and manipulated beginner code from the previous tutorial's just fine.