|Home | Tutorial | Classes | Functions | QSA Workbench | Language | Qt API | QSA Articles | Qt Script for Applications | ![]() |
[Prev: Assignment Operators] [Home] [Next: String Operators]
These operators are used to perform arithmetic computations on their operands.
operand1 + operand2
This operator returns the result of adding the two operands (operand1 and operand2).
See also + string operator.
++operand; // pre-increment operand++; // post-increment
The pre-increment version of this operator increments the operand, and returns the value of the (now incremented) operand.
The post-incremented version of this operator returns the value of the operand, and then increments the operand.
var result = operand1 - operand2; // subtraction operand = -operand; // unary negation
The subtraction version of this operator returns the result of subtracting its second operand (operand2) from its first operand (operand1).
The unary negation version of this operator returns the result of negating (changing the sign) of its operand.
--operand; // pre-decrement operand--; // post-decrement
The pre-decrement version of this operator decrements the operand, and returns the value of the (now decremented) operand.
The post-decremented version of this operator returns the value of the operand, and then decrements the operand.
operand1 * operand2
This operator returns the result of multiplying the two operands (operand1 and operand2).
operand1 / operand2
This operator returns the result of dividing the first operand (operand1) by the second operand (operand2).
Note that division by zero is not an error. The result of division by zero is Infinity.
operand1 % operand2
This operator returns the integer remainder (which may be 0) from the division of operand1 by operand2.
[Prev: Assignment Operators] [Home] [Next: String Operators]
Copyright © 2001-2006 Trolltech | Trademarks | QSA version 1.1.5
|