Notes
=
sign is an assignment operator and it assigns a value to a variable.
Integer x = 5;
System.debug(x);
The operator +
adds two variables.
Integer x = 5;
Integer y = 12;
Integer z = x + y;
System.debug(z);
The operator -
subtracts a variable from a variable.
Integer x = 16;
Integer y = 12;
Integer z = x - y;
System.debug(z);
The operator * multiplies a variable with another variable.
Integer x = 5;
Integer y = 4;
Integer z = x * y;
System.debug(z);
The operator / divides a variable by a variable.
Integer x = 12;
Integer y = 2;
Integer z = x / y;
System.debug(z);
Increment operator.
Adds 1 to the value of x, a variable of a numeric type. If prefixed (++x), the expression evaluates to the value of x after the increment. If postfixed (x++), the expression evaluates to the value of x before the increment.
Integer x = 7;
x++;
System.debug(x);
Integer x = 7;
++x;
System.debug(x);
The operator -- decreases a variable or a number by 1.
Integer x = 12;
x--;
System.debug(x);
or
Integer x = 8;
--x;
System.debug(x);