[Other] Logical operators are divided into short-circuit and non-short-circuit?

What is a short-circuiting logical operator?

Logical value , used to express the truth of the result, its value is true or false, some languages ​​will use 0 or non-zero to express.

Logical operators are to combine and operate logical expressions or logical values ​​to obtain a new logical value. Logical operators are composed of AND operation (&&) or operation (||) and NOT operation (!), AND operation ( &&) and OR (||) are binocular operators, that is, they must carry two logical values ​​for operation, and the not operator (!) is a unary operator, that is, calculate a single value. It should be noted here that in our Java we are talking about AND operation and OR operation. Generally refers to our short circuit and or short circuit or. There are also non-shorting and (&) and non-shorting or (|) in Java.

The difference between short-circuit and non-short-circuit is that when multiple expressions are combined to operate, if the previous expression can already get the final result, the short-circuit operation will not calculate the following expression, and the non-short-circuit operation will not calculate the result. All expressions are executed.

Guess you like

Origin blog.csdn.net/weixin_43918614/article/details/124072632