Conditional Operator

Previous lesson: Logical XOR

Your Next-to-Last Operator!
The conditional operator looks like this: $$\to$$

It is a diadic operator.

Perhaps I should explain conditional operators through a story. Let's suppose that Joe Lion is given a wildebeest if he beats Handsome Dan XVII. Thus, $$p$$ becomes "Joe Lion beats Handsome Dan" and $$q$$ becomes "Joe Lion is given a wildebeest." The order of p and q are important, and so p and q are given special terms when the conditional operator is used. p is the antecedent. q is the consequent.

There are four possible outcomes in this story:

1. Joe Lion beats Handsome Dan, and is given a wildebeest. (p is true and q is true) 2. Joe Lion beats Handsome Dan, but is not given a wildebeest. (p is true and q is false) 3. Joe Lion does not beat Handsome Dan, yet is given a wildebeest. (p is false and q is true) 4. Joe Lion does not beat Handsome Dan, and is not given a wildebeest. (p is false and q is false)
 * $$p$$ $$\to$$ $$q$$ is true.
 * $$p$$ $$\to$$ $$q$$ is false. In other words, the condition (that Joe Lion is given a wildebeest if he beats Handsome Dan) is violated.
 * $$p$$ $$\to$$ $$q$$ is true. The conditional statement (that Joe Lion is given a wildebeest if he beats Handsome Dan) has not been violated, because violation only occurs if the antecedent is true.
 * $$p$$ $$\to$$ $$q$$ is true. The conditional statement (that Joe Lion is given a wildebeest if he beats Handsome Dan) has not been violated, because violation only occurs if the antecedent is true.

Next Lesson
The next lesson is called Biconditional Operator.