Introduction:
Operators are widely used in any language. The same is true in Easy Language. Operators of Easy Language can be divided into arithmetic operators, comparison operators, logical operators and assignment operators. Let’s talk about various operators.
Operator classification:
The operators displayed are all code styles displayed in Easy Language code. If you enter * on the multiplication keypad, you can display × in the Easy Language code.
Arithmetic operators:
Used to perform mathematical operations on the arithmetic numbers.
1. + plus sign, used for addition operation, example: 1+2=3
2. - Minus sign, used for subtraction operation, example: 2-1=1
3. × multiplication sign, used for multiplication operation, example: 2*3=6
4. ÷ Dividing sign, used for division operation, example: 6/2=3
5. % Modular operation takes the remainder, and divides the two numbers to get the remainder Example: 10%3=1
Comparison operator:
Compare the size relationship between two numbers. The characters before the operator are compared with the characters after the operator.
1. ﹥ Greater than the sign, example: 1﹥0 The output result is: true
2. ﹤ is less than the sign, example: 1﹤0 The output result is: false
3. ≥ greater than or equal to, Example: 1≥1 The output result is: true, greater than or equal to satisfy one condition is true
4. ≤ Less than or equal to, Example: 1≤1 The output result is: true, less than or equal to satisfy one condition is true
5. = equal sign, and determine whether it is equal. It can not only be used for numerical judgment, but also for character judgment.
Example 1: 1=1 The result is true Example 2: "Hello" = "Hello" The result is true
6. ≠ Inequality sign, easy language display as ≠, input method, <> or !=
Example: 2 ≠ 2 The result is false.
Logical operators:
Event logic, used for conditional judgment.
1. And, when two logical events are true at the same time, they are determined to be true.
example:
Version 2
.If (2 > 1 and 3 > 2)
Information box ("No problem", 0, , )
. Otherwise
Information box ("Flawed", 0, , )
The result will output the message box: There are defects
2. Or When one of the two logical events is true, it is determined to be true.
example:
Version 2
.If (2 > 1 or 3 > 2)
Information box ("No problem", 0, , )
. Otherwise
Information box ("Flawed", 0, , )
The result will output the message box: No problem
3. Take the opposite side. Take the opposite side of the logical judgment, the truth changes to false, and the false changes to true.
Example: Inverse (1>2) The result is true
Assignment operator:
The difference between = and the comparison operator is that the usage scenario is different. In logical judgment, use = is the comparison operator, and whether the comparison is consistent. When using it when defining or assigning a value to a variable, that is, assigning the value after = to the object before =.
example:
Version 2
. Local variable counting, integer type
Count times = 1
The above code is to assign a value to the count variable. If you use debug output (counting count), you can get the result of 1.
Conclusion:
Various operators are widely used in Yi language. It can be said that operators support the operation of code logic. Understanding and being good at using operators can make us more efficient in writing code.
This is the end of this article about the detailed summary of the classification of Easy Language Operators. For more relevant content of Easy Language Operators, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!