There are three types of operators that can be used in programs: Calculation Operator, Logical/Comparative Operator, and Others.
(1) Calculation Operator
...
In the table shown below, the calculation result assumes that the variable A is 1 (True) and the variable B is 0 (False). In Xpanel, the values other than 0 are all processed as True. Only 0 is recognized as False.
...
In this case, the value of A and B will be set as C. In other words, the value at the rightmost side of the operator will be treated as the result value of the “=” operation. The example mentioned above will be processed internally in the program as shown below.
...
| The features of the “=” operator may cause a program error that cannot be detected as shown below. Even if the values of A and B are not equal, the operation result of the IF statement can be True. This operation may cause an unwanted B value to be stored in A.
//=================== // A Program Error That Cannot Be Detected //=================== If (A=B) // Mis-entry of A==B, checking if the value of A and B are the same. { … } |