Comparison operators allow you to compare two or more values.
The hardest part about learning comparison operators is remembering the order of the characters, for example, the character
= comes first.
Here is a list of all comparison operators, some of which you have already met:
|more or equal|
|less or equal|
The program will show the truth of each expression, that is, if the expression is true, the program will show
1, and if the expression is false, it will show
Comparison operators will be used for loops and branch operators.
It is very important to understand the sequence of operators.
Solve the example: 2+2*2 =? If your answer is 8, then do not despair, the author of this course also does not know mathematics well.
The increment/decrement operators have very high precedence, meaning they will be executed first. Next, come the division and multiplication operators, and lastly, the sum and difference operators.
Expression precedence can be emphasized with parentheses. For example, the expression
Maybe rewritten as:
Everything was clear?