User:Jax2020/sandbox

If you missed lesson #2, you can take a look at it here.

Intro
Today’s lesson will cover the concept of logical operators, what they are and how to use them. The logic behind them is very simple. No pun intended they are called logical operators after all. View them as simple electrical circuits. There are three possible outcomes based on which current will flow through the hypothetical wires.

Again with the operators…
Last lesson we covered what operators and expressions are. Operators, just as their names state, operate on one or two values. These values must eventually be equal to a Boolean value, a simple   or . Logical operators are, in turn, very similar to the arithmetic operators we learned about last lesson. The way they behave is at the logical level almost the same. The key exception being on what types of values the operators can be applied to.

Logical operators can be applied to Boolean values themselves. Meaning, they are used to reason with Booleans. Let’s say you want to make sure both   is greater than   and   is less than . Only if both of these expressions hold   will the logical operation hold . In another case, let’s say you want to check whether   is equal to   or   is equal to . It’s perfectly fine if only one of the two arithmetic expressions holds , the logical operation will hold .