logic operators

logic operators

There are three logic operators and(&) or ( | | ) and not(!). If you read the post on gates you will see that logic operators follow the same rules. Those rules being that for and it takes two conditions and both must be true for the statement to be true, while with or only one statement must be true, for the entire thing to be true. Not is where if the condition/ comparison is true then the not turns it false, while if the condition/comparison is false it turns it true.

There are several smaller things involved with logic operators. Those things are short circuit evaluation which is where the compiler doesn’t go through the entire condition because it has already determined whether or not the entire condition will be false.

A more in depth explanation is at this link:(not posted yet)

Another thing is De Morgan’s laws or !(a && b) equals ! a || !q and where !(a || b) equals !a & !b.

Alse results of logic operators will be a boolean datatype, like gates and conditions generally are.