Skip to main content

Operators

An operator in computer science is usually a symbol or a set of symbols that represent an action. It tells the programme to perform a specific set of instructions or calculations.

Arithmetic Operators

Arithmetic operators are used to perform maths operations:

OperatorDefinition
+Addition
-Subtraction
*Multiplication
/Division
%%Modulus: returns the remainder of the division of the number to the left by the number on its right
%/%Quotient: returns the quotient by integral division
^Exponential

Relational Operators

Relational operators are used to compare two values:

OperatorDescription
>TRUE when first value is greater than second value
<TRUE when first value is smaller than second value
<=TRUE when first value is less than or equal to second value
>=TRUE when first value is greater than or equal to second value
==TRUE when first value is equal to second value
!=TRUE when first value is not equal to second value

Logical Operators

OperatorDefinition
&AND operator (element-wise)
&&AND operator (vector-wise)
!Logical NOT (will return a statement as FALSE, if it is TRUE)
IOR Operator (element-wise)
IIOR operator (vector wise)