WLJS LogoWLJS Notebook

Decrement

x-- decreases the value of x by 1, returning the old value of x.

Examples

Decrement a variable:

x = 5;
x--
(* 5 *)
x
(* 4 *)

In a loop:

i = 3;
While[i-- > 0, Print[i]]
(* prints 2, 1, 0 *)

Please visit the official Wolfram Language Reference for more details.

On this page