Skip to main content

Operators are symbols that occur in nearly all programming and coding languages, used for performing calculations, comparisons, and assignments of data. Use this tag for any questions relating to operators, in any language, including things such as syntax, behaviour and use.

There are four main types of operators:

  • Arithmetic operators such as add (+), subtract (-), times (*), divide (/) and other numerical calculations.

  • Comparison operators, which give the result of a comparison between numbers or strings, for example greater than (>), less than (<), equal to (==).

  • Logical operators include things like AND (&&) and OR (||).

  • Binary operators perform bitwise operations on the binary representation of variables such as AND (&), OR (|), NOT (~), XOR(^), LSHIFT (<<), and RSHIFT (>>).

There are other operators, such as assignment and concatenation.