Logical operators are used to combine or modify conditions. They help computers and programs make decisions based on different situations.
AND
The AND operator is used when two or more conditions must be true at the same time.
If all conditions are true, the result will be true.
If one condition is false, the result will be false.
Example
If a student studies AND completes homework, the teacher gives good remarks.
Another Example
If a number is greater than 5 AND less than 10, it lies between 6 and 9.
OR
The OR operator is used when at least one condition must be true.
If one condition is true, the result will be true.
If both conditions are false, the result will be false.
Example
A student can join the class if he submits the assignment OR gets permission from the teacher.
Another Example
A number is accepted if it is equal to 5 OR equal to 10.
NOT
The NOT operator is used to reverse the condition. It changes true into false and false into true.
Example
If it is NOT raining, we will go outside to play.
Another Example
If a student is NOT present, he will be marked absent.
Conclusion
AND requires all conditions to be true.
OR requires at least one condition to be true.
NOT changes the meaning of the condition to its opposite.