Below we have a list of rules that each operator follows. For bitwise operators, we work with binary numbers. Hence, instead of false and true, we will be using 1 and 0 where 1 acts as true and 0 acts as false. bit can be either 1 or 0.
Let’s now see these rules in action. We will take the first operand A to be 12 and second operand B to be 5.
Try to figure out what the output would be before pressing RUN.
Below, you’ll find a list of the reduction rules for logical operators. The list is handy as it will summarize how each operator reduces expressions into their final form.
exp is an arbitrary expression that can be replaced with an operand of type Boolean. The operand can be true or false itself or can be an expression that reduces to true or false.
Let’s now see these rules in action. For example, our arbitrary expression exp will be A && B whereA is true and B is false.
Try to figure out what the output would be before pressing RUN.