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

It decrements the value of the instance.


Table of contents:


Format

Expression

--

Semicolon

Example

Format

The format of the decrement statement is:


expression -- ;


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

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

Expression

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


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

--

Postfix -- operator. indicates that it is an decrement statement.

Semicolon

The end of a decrement 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 9.

6:

em

7:

ec

Next
Previous
Copyright © Rice All rights reserved.