Logical Operators

Programming languages use a lot of symbols that are abbreviations for important concepts. Among the most common are Boolean And (&&) and Boolean Or (||). These are generally used as part of an IF statement.

The Boolean And ties together two or more booleans (a variable or statement that results in a true/false value). For example, if I only wear my raincoat on days when I have to go to school And it's raining, I can express that like this:

The contents of the if block will only be executed if both the variables are true.

The Boolean Or also ties together two or more booleans, but it evaluates to true if any of the variables are true. For example, if I get to sleep in on the weekends Or on snow days, I can express that like this:

The contents of the if block will be executed if it's a weekend, or if it's a snow day (or if it's both a weekend and a snow day).