An operator is something that you feed with one or more values (or expressions, in programming jargon) which yields another value. There are two types of operators. Firstly there is the unary operator which operates on only one value, for example ! (the negation operator). The second group are termed binary operators which operates with two value; this group contains most of the operators that GPC supports.

  1. Arithmetic Operators

      Remember basic arithmetic from school? These work just like those.
a + b      Addition        Sum of a and b
a - b      Subtraction     Difference of a and b
a * b      Multiplication  Product of a and b
a / b      Division        Quotient of a and b
a % b      Modulus         Remainder of a divided by b
      The division operator ("/") drops any fractions and returns an integer value. For example, 7 / 3 = 2 because the fraction is dropped. Note that integer division does not round. For example, 3 / 4 = 0, not 1.

  2. Assignment Operator

      The assignment operator is "=". Your first inclination might be to think of this as "equal to". Don't. It really means that the left operand gets set to the value of the expression on the rights (that is, "gets set to").

  3. Comparison Operators

      Comparison operators, as their name implies, allow you to compare two values.
a == b     Equal                TRUE if a is equal to b
a != b     Not equal            TRUE if a is not equal to b
a < b      Less than            TRUE if a is less than b
a > b      Greater than         TRUE if a is  greater than b
a <= b     Less or equal to     TRUE if a is less or equal to b
a >= b     Greater or equal to  TRUE if a is greater or equal to b

  4. Logical Operators

!a         Not     TRUE if a is not TRUE
a && b     And     TRUE if both a and b are TRUE
a || b     Or      TRUE if either a or b is TRUE
a ^^ b     Xor     TRUE if either a or b is TRUE, but not both

  5. Operator Precedence

      The precedence of an operator specifies how "tightly" it binds two expressions together. For example, in the expression 1 + 5 * 3, the answer is 16 and not 18 because the multiplication ("*") operator has a higher precedence than the addition ("+") operator. Parentheses may be used to force precedence, if necessary. For instance: (1 + 5) * 3 evaluates to 18.
      The following table lists the precedence of operators with the highest-precedence operators listed at the top of the table. Operators on the same line have equal precedence, in which case their associativity decides which order to evaluate them in.
!               logical (right)
* / %           arithmetic (right)
+ -             arithmetic (right)
== !=           comparison (right)
< <= > >=       comparison (right)
&&              logical (right)
||              logical (right)
^^              logical (right)
=               assignment (right)
Left associativity means that the expression is evaluated from left to right, right associativity means the opposite.