# Lesson 2 Homework 1.3: Understanding the Different Types of Logical Operators

Logic operators are a fundamental part of computer programming, and understanding how to use them is essential for any programmer. In this lesson, we will discuss the different types of logical operators and how they can be used to create complex logic statements.

## AND Operator The AND operator is used to combine two conditions and return true if both conditions are true. For example, if x is 5 and y is 6 then the expression “x == 5 && y == 6” will return true. The AND operator is also known as the logical conjunction and is represented by the symbol “&&”.

## OR Operator The OR operator is used to combine two conditions and return true if either condition is true. For example, if x is 5 and y is 6 then the expression “x == 5 || y == 6” will return true. The OR operator is also known as the logical disjunction and is represented by the symbol “||”.

## NOT Operator The NOT operator is used to negate a condition and return the opposite of the condition. For example, if x is 5 then the expression “!(x == 5)” will return false. The NOT operator is also known as the logical negation and is represented by the symbol “!”.

## XOR Operator The XOR operator is used to combine two conditions and return true if one condition is true and the other condition is false. For example, if x is 5 and y is 6 then the expression “x == 5 ^ y == 6” will return false. The XOR operator is also known as the exclusive or and is represented by the symbol “^”.

## 

In this lesson, we discussed the different types of logical operators and how they can be used to create complex logic statements. We looked at the AND, OR, NOT, and XOR operators and how they can be used to evaluate conditions in code. Knowing how to use logical operators is an essential skill for any programmer, so be sure to practice and become comfortable with using them.