k8:k8.5:start
8.5 Rank of operators
Most operators are available as binary operators. These require two operands to which they are applied. Unnary operators, on the other hand, only change one operand. A distinction is made between the individual operations according to priority and associativity if there are at least two operators in a statement.
- Priority describes the ranking order of operations for mathematical terms or expressions.
- The higher the priority (rank, ranking) of an operator, the more likely the corresponding operation will be executed.
- If there are at least two operators of equal rank, then associativity determines the ranking.
- Ranking and associativity of the operators determine the order in which operands are processed.
- “Links associativity applies to all binary operators, with the exception of the assignment operators. This means that the operators on the left side are processed before the operators on the right side.” [http://help.adobe.com/de_EN/AS2LCR/Flash_10.0/help. html? content=00000115. html]
- You can control the ranking order in operations to be performed when you use parentheses in mathematical terms or expressions.
| Operator | Priority - Rank - Ranking |
|---|---|
| - sign, NOT | maximal |
| IS | 11 |
| & | 9 |
| &/ | 8 |
| ^ | 7 |
| * / DIV \ MOD % | 6 |
| + - | 5 |
| OR AND AND XOR | 2 |
Table 8.5.1: Ranking of operators
Example:
[1] Dim sElement As String [2] Dim aMatrix As String[] [3] [4] ... [5] aMatrix = Split(tts, " ") [6] For Each sElement In aMatrix [7] ' If TypeOf(Val(sElement)) <= gb.Float = True Then [8] If [TypeOf(Val(sElement)) <= gb.Float] = True Then [9] ' If (IsNumber(Val(sElement)) = True) = True Then ' No error message [10] sText = sText & " " & sElement [11] ... [12] Next ' sElement [13] ...
The code in line 7 triggered an error. The following error message came up, which at the same time pointed the right way:
Unclear expression. Please insert square brackets in FMain.class:1234
But also with round brackets the error message disappeared, as the adequate source code in line 9 showed.
k8/k8.5/start.txt · Last modified: by 127.0.0.1
