当前位置:网站首页>Common operators and operator priority

Common operators and operator priority

2022-07-05 19:38:00 Try some fresh food with a child

One 、 Common operators
1、 Arithmetic operator
2、 Relational operator
3、 Logical operators
4、 Assignment operator
5、 Conditional operator ( The only ternary operator )

Two 、 Arithmetic operator
Basic arithmetic operators
/ * % + -

3、 ... and 、 Relational operator
Test the relationship between two values , Return to true or false
<
<=

=
==
!=
===
!==

Four 、 Logical operators
-&&( Logic and ): Only when both the operand and the second operand are ture when , Others are false
-!!( Logic or ): Only when the first operand and the second operand are false, result false, Others are true
-!( Logic is not ): Inverse

5、 ... and 、 Assignment operator
=、+=、-=、*=、/=、%=

6、 ... and 、 Conditional operator
Ternary operator :–?--:–
The first operand is Boolean , by ture, Calculate the second operand , And return the calculation results , otherwise , Calculate the third operand , And return the calculation results

7、 ... and 、 Operator priority

Operator operation
Logic is not
* 、/、 % ride 、 except 、 Remainder
<、<=、>、>= Less than 、 Less than or equal to 、 Greater than 、 Greater than or equal to
==、!= Judgment is equal to the 、 Judgment does not equal
===、!= Judgement is equal to 、 Judgment is not equal to
&& Logic and
ll Logic or
?: Conditional operator
=、+=、-=、*=、/=、%= etc. Assignment operator
原网站

版权声明
本文为[Try some fresh food with a child]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207051935562253.html