# More on OR

The logical operator OR is written $||$ when writing a program in Java. Here both OR and $||$ are used because you need to know both.

Often T is written for true and F for false.

##### Example 1

find the truth value of $6-6=0||1\le 2$.

Answer: (This is the same as asking for the truth value of $6-6=0$ OR $1\le 2$.)

Firstly we need to determine the truth value of $6-6=0$ and of $1\le 2$: $6-6=0$ is T (true) and $1\le 2$ is T. We have $\underbrace{6-6=0}_{T}||\underbrace{1\le 2}_{T}$. That is, we have T||T.

The truth table for $||$ shows that T||T is T. The answer is T.

##### Example 2

Find the truth value of $2+2=10$ OR $1\le 2$.

Answer: (this is the same as asking for the truth value of $2+2=10||1\le 2$.)

$2+2=10$ is F, (false) and $1\le 2$ is T (true). So we have $\underbrace{2+2=10}_{F}$ OR $\underbrace{1\le 2}_{T}$, which is F OR T. From the truth table for $||$ we see that F||T, which is the same as F OR T, is T. The answer is T.

##### Example 3

Find the truth value of $2+2=10$ OR $2\times 2=22$.

Answer: $2+2=10$ is F and $2\times 2=22$ is F. So we have $\underbrace{2+2=10}_{F}$ OR $\underbrace{2\times 2=22}_{F}$, which is F OR F. From the truth table for $||$ we see that F$||$F is F. Therefore F OR F is F. The answer is F.

##### Example 4

Find the truth value of $1\le 2||2+2=10$.

Answer: We have $\underbrace{1\le 2}_{T}||\underbrace{2+ 2=10}_{F}$, which is T$||$F. From the truth table for $||$ we see that T$||$F is T. The answer is T.

 $5-3=0||-1\lt 1$ True False The sky is always red OR Finnish is the main language of Australia. True False $23\le 100$ OR $0=0$ True False $23\le 100||0+1=0$ True False