Operator Types
An operator is a symbol which tells the interpreter to perform specific mathematical, relational or logical operation and produce final result. This section details the operators available in GPC.
=
is the assignment operator. Think of this as gets set to rather than equal to. When =
is used, the left operand gets set to the value of the right operand. There are also a number of short hands for common tasks such as incrementing a value by a set amount.
Operator
Description
=
Sets the left operand to the value of the right operand
+=
Sets the left operand to the value of the left operand plus the right operand
-=
Sets the left operand to the value of the left operand minus the right operand
*=
Sets the left operand to the value of the left operand multiplied by the right operand
/=
Sets the left operand to the value of the left operand divided by the right operand
%=
Sets the left operand to the remainder of dividing the left operand by the right operand
In the example below, assume a
holds a value of 10
.
Last updated
Was this helpful?