RAD Studio |  |

Arithmetic Operators

Syntax

Copy Code

    + cast-expression
    - cast-expression
    add-expression + multiplicative-expression
    add-expression - multiplicative-expression
    multiplicative-expr * cast-expr
    multiplicative-expr / cast-expr
    multiplicative-expr % cast-expr
    postfix-expression ++       (postincrement)
    ++ unary-expression         (preincrement)
    postfix-expression --       (postdecrement)
    -- unary-expression         (predecrement)

Remarks

Use the arithmetic operators to perform mathematical computations.

The unary expressions of + and - assign a positive or negative value to the cast-expression.

- (addition), - (subtraction), * (multiplication), and / (division) perform their basic algebraic arithmetic on all data types, integer and floating point.

% (modulus operator) returns the remainder of integer division and cannot be used with floating points.

++ (increment) adds one to the value of the expression. Postincrement adds one to the value of the expression after it evaluates; while preincrement adds one before it evaluates.

-- (decrement) subtracts one from the value of the expression. Postdecrement subtracts one from the value of the expression after it evaluates; while predecrement subtracts one before it evaluates.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!