Home News DOC Class DL Others Cooker
Documents  >  Tutorial  >  Increment
Increment statement

It increments the value of the instance.


Table of contents:


Format

Expression

++

Semicolon

Example

Format

The format of the increment statement is:


expression ++ ;


It is a statement in which a single expression is followed by the postfix ++ operator and a semicolon.

Increases the value of the instance returned by the expression by 1.

Expression

It is an expression that returns an instance that is incremented.


The returned instance must be an int, long, or real class.

++

Postfix ++ operator. indicates that it is an increment statement.

Semicolon

The end of a increment statement is represented by a semicolon.

Example

1:

class example

2:

int var1;

3:

open method void someMethod()

4:

var1 = 10;

5:

var1++; // var1 is 11.

6:

em

7:

ec

Next
Previous
Copyright © Rice All rights reserved.