Siebel eScript Language Reference > Using Siebel eScript > Using Operators in Siebel eScript >

Increasing or Decreasing the Value of a Variable


You can use the increment or decrement operator in the following ways:

  • Before a variable. Siebel eScript modifies the variable before it uses it in a statement.
  • After a variable. Siebel eScript modifies the variable after it uses it in a statement.

These operators add or subtract 1 from a value. For example, i++ is shorthand for i = i + 1.

To increment or decrement a variable

  • To add 1 to a variable, you use the following operator:

    ++

  • To subtract 1 from a variable, you use the following operator:

    --

The following example uses increment and decrement operators:

var i;
var j;
i = 4; //i is 4
j = ++i; //j is 5 and i is 5. Siebel eScript incremented i first.
j = i++; //j is 5, i is 6. Siebel eScript incremented i last.
j = --i; //j is 5, i is 5. Siebel eScript incremented i first.
j = i--; //j is 5, i is 4 Siebel eScript incremented i last.
i++; //i is 5. Siebel eScript incremented i.

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.