 Sometimes you need to test more than one condition at a time. As in this example, where a valid score must be greater than or equal to 0 and less than or equal to 100. Here's how you write that in C. The AND is written with two ampersands in a row. For an AND operation to be true, both of its operands must be true. Here's the truth table that shows how AND works. That's a bit abstract, so here's a more concrete example. When condition A is, I have a square, and condition B is, I have a circle. The compound condition A and B, I have a square and a circle, is true only when A is true and B is true, when both operands are true. Another way to combine conditions is with OR. You get a lower price if your age is less than 16 OR if it's greater than or equal to 65. Here's how we write that in C. Using two vertical bars in a row to mean OR. On US keyboards, the vertical bar is usually on the key with the backslash. It might be shown as a broken vertical bar. That's to distinguish it from the capital letter I. Here's the truth table for OR. And here's a concrete example with the squares and circles. The only part that seems weird to people is this last case, where both A and B are true. If you have both, you still have at least one of them, so this turns out to be true. What if you really do want either A or B but not both, as in this example? Here we don't want to mail an envelope that's too small, but we don't want to mail one that's too big either. Here's the code for that in C. Using the circumflex operator whose official name is Exclusive OR. Here's its truth table. And here's the example using the envelope length and width. In this example of Exclusive OR, I put parentheses around the conditions. I had to do that, or the compiler would give me a warning. The reasons for that would sidetrack me tremendously if I would discuss them. But it does bring up an important point. Just as with arithmetic operators, where multiplication and division are more important than addition and subtraction, logical operators also have precedence. That means that this test, as written, is incorrect. Without parentheses, it says that the discount is for young people on Saturdays or anyone at all on Sunday. To make this work correctly, we need to use parentheses to force the OR to be evaluated first. Now it says the discount is for anyone less than 16 and the day must be Saturday or Sunday. Most people don't have the precedence tables memorized, especially for logical operators. Don't leave this to chance. When in doubt, and even if you aren't in doubt, use parentheses to make your intentions clear when you're doing compound conditions.