Gentee Programming Language > Documentation > Syntax Download documentation

Increment And Decrement Operators

The operators ++ and -- are unary operators and deal with only integers. The increment and decrement operators occur in “l-value” expressions.
++ is the increment operator. This operator is expressed in two notations: the prefix-form ++i and the postfix form i++. In the prefix form, variable i is incremented by the integer value 1, new value of variable i is used in the expression evaluation; in the postfix form, the increment takes place after the value of variable i is used in the expression evaluation.
-- is the decrement operator. The prefix notation is --i - the variable is decremented by one and the result is this decremented value. The postfix notation is i-- - the decrement occurs after the value of variable is used in expression evaluation.

i = 10
x = i++ // x = 10, i = 11
i = 10
x = ++i //x = 11, i = 11

See also

    Table Of Operator Precedence


 Copyright © 2004-2006 Gentee Inc. All rights reserved.