 To begin to do more interesting things in code, we need yet more operators. First off, the EQ operator performs an equality test on two or more operands. When all the operands have the same value, EQ returns the boolean value true, but otherwise returns false. So here the first two examples return true, but the last example returns false because 6 is not equal to 2. The not operator takes a single boolean value and returns the reverse truth value, so not true returns false and not false returns true. These two operators, EQ and not, come in useful for what we can call conditional execution. When we write code, we often want a section of code that is executed only conditionally, that is, depending upon some condition, the block is either executed or skipped over. For this purpose, we have in pigeon the if statement, and if statement is written beginning with the reserved word if, followed by condition, and then on the following lines we write what is called the body. The body consists of one or more other statements, but these statements are written indented under the if. The way the if works is that the condition, which is some expression returning a boolean value, is evaluated and, if that condition returns true, then the body is executed. Otherwise, if the condition returns false, the body is skipped over. So that's why it's called if. It has a sense of if this condition is true, then do this stuff, otherwise skip over this stuff. Here in this example, we have an if where the condition is the expression EQX3, and the body consists of two statements, the first printing cat and the second printing dog. So when this code executes, if the quality operator returns true, because x does equal 3, then first the code will print cat, then it will print dog, and then execution continues in the line after the if, in this case a line that prints bird. If, on the other hand, x at this point does not equal 3, the quality operation will return false, and so the statements of the if body will get skipped over, so this code will just print bird. Other times in code, we want not just to skip over something, we want to make a choice of either doing one thing or another thing, and this is called mutual exclusion. We do one thing or the other, but not both. For this purpose, we can simply use two separate if statements by giving them logically inverse conditions. So when this example executes, when x equals 3, the condition of the first will be true, but the condition of the second will be false, so the code will print high, but not by. On the other hand, when x does not equal 3, then the condition of the first will test false, but the condition of the second if will test true, so this code will print by, but not high. Because mutual exclusion is used very commonly, rather than having to write two separate if statements, we have a special convenience, the else clause. An if statement can be followed by an optional else clause, which begins with the reserved word else and has its own body. When the if statement is executed and the condition is true, the first body is executed, but the body of the else is not. Conversely, when the condition tests false, the body of the else is executed, but the first body is not. So for example here, when the condition is tested and x does equal 3, then this code prints high, otherwise when x does not equal 3, it prints by. Now in some cases, you might wish to have mutual exclusion between more than just two cases. You might have three cases as we have here. In this example, again, when the condition tests true, we execute just the body of the if, otherwise we execute the body of the else. But this else body itself contains another if statement, so when the else executes, the condition of the if statement is tested, and if true, then it prints by, otherwise not. Effectively, we have three mutually exclusive cases here. When x equals 3, the code prints high, when x equals 5, it prints by, but when x doesn't equal 3 or 5, then nothing happens. To make it easier to write such cases, we can have clauses beginning with the reserved word elif, which is a contraction of else and if. Elif clauses effectively combine an else with an if. When you see an if with an elif clause, as usual, the condition of the if is tested, and when it's true, then the first body is executed, but when false, then we test the condition of the elif, and when that is true, we execute the body of the elif, otherwise we skip over that body as well. So we can rewrite the previous example with an elif like so. We can actually give an if more than one elif clause, effectively adding on more mutually exclusive cases. So here in this example, as usual, we start at the top and test the condition of the if itself, and when it's true, we print high and then skip over all the elif clauses, otherwise we test the condition of the first elif clause, and when that's true, we execute its body, otherwise we test the condition of the next elif, and so forth. So in short, the way this works is that the conditions are tested from top to bottom, and the first one that tests true, its body is the one and only one to execute. In the case that none of the conditions test true, then all the bodies get skipped over. So we effectively have five mutually exclusive cases. When x equals 3, we print high, when x equals 5, we print bi, when x equals negative 7, we print mu, when x equals 14, we print wuf, and when x doesn't equal any of those values, we don't print anything because we've skipped over the bodies of each clause. When an if does have one or more elif clauses, it can also end with an else clause. The else clause effectively acts as the default, such that when none of the conditions test true, it's the else clause which gets executed. So here, when x doesn't equal 3, you're 5 or negative 7, the code prints meow.