More on Precedence

This page contains more examples of expressions using several operators.

Expressions must be evaluated in the right order. $$\boxed{\text{Evaluate expressions in brackets first.}}$$

NOT has precedence over AND and OR, so unless brackets indicate otherwise $$\boxed{\text{NOT is done before AND, OR.}}$$

Examples

Fins the truth values of each expression

  • $2=2||!3=3$.
    Answer: Note that $2=2$ is T, $3=3$ is T and $!3=3$ is F.
    There are no brackets, so we evaluate $!$ before $||$:
    $\underbrace{2=2}_{T}||\underbrace{!3=3}_{F}$ is T$||$F. This is T.
  • $2=2||(!3=3)$.
    Answer: We must evaluate the $!$ before the $||$. This is what was done in the previous example because $!$ has precedence over $||$. The answer is T.
  • $!2=2||3=3$.
    Answer: $!$ has precedence over $||$, so $!2=2$ is evaluated first: $!2=2$ is $!$T which is F. Therefore $\underbrace{!2=2}_{F}||\underbrace{3=3}_{T}$ is F$||$T which is T.
  • $!(2=2||3=3)$.
    Answer: We must deal with the expression in brackets first. This is $\underbrace{2=2}_{T}||\underbrace{3=3}_{T}$. This is T$||$T, which is T.
    Therefore $!\underbrace{(2=2||3=3)}_{T}$ is $!$T which is F.
More for you to try

Find the truth value of each statement (that is, decide whether each is true or false).

$!5-3=0||-1\lt 1$
$!(5-3=0||-1\lt 1)$
The sky is always red OR Finnish is not the main language of Australia.
$!$(The sky is always red OR Finnish is not the main language of Australia).
$23\lt 100$ OR $!0=0$
$!(23\le 100||0+1=0)$.
$0=0\&\&!(23 \le 100||0+1=0)$