The Logical Operators
- 
					
					
					
					
 PrerequisiteDescriptionThe logical operators (AND, OR, and NOT) are Boolean blocks in the operators category. They take 2 boolean blocks as inputs, and produce an answer as true or false. 
 The “AND” BlockThe AND block checks if 2 conditions are both true. It gives the answer “true” when both input blocks are true; otherwise, it gives an answer of “false”. There can be 4 possible input combinations: - true AND true  ️ true ️ true
- true AND false  ️ false ️ false
- false AND true  ️ false ️ false
- false AND false  ️ false ️ false
 Here is how you can use the AND block with variables:  
 The “OR” BlockThe OR block check if at least one of the 2 conditions is true. It gives the answer “true” when either input block is true; if both input blocks are false, the OR block gives an answer of “false”. There can be 4 possible input combinations: - true OR true  ️ true ️ true
- true OR false  ️ true ️ true
- false OR true  ️ true ️ true
- false OR false  ️ false ️ false
 Here is how you can use the OR block with variables:  
 The “NOT” BlockThe NOT block gives us the opposite answer to the input block. If the input block is “true”, then the NOT block would give an answer of “false”. If the input is “false”, then the NOT block would give an answer of “true”. Here are some examples:  
 Combining multiple logical blocksYou can insert logical operator blocks inside each other to check for more conditions at the same time. Here are some examples:  
 Common Mistakes When Used with VariablesHere are some common mistakes when using logical operator blocks with variables. 1. X>10 AND X<10The variable “X” cannot be greater than “10” and less than “10” at the same time. So this condition will always be false, no matter what’s the value of the variable “X”.  
 2. X>20 OR X=20The condition “X>20 OR X=20” can be simplified by using the **“>=” block.  
 3. X>10 And X>20The condition “X>10 AND X>20” can be simplified to “X > 20”, because for it to be true, “X” has to be greater than 20, so the first part of “X>10” is not necessary.  
 
- true AND true