In computer programming, an operator is a symbol used to perform an operation on some data. For example, we can use the plus sign (+
) to add two values: numbers, vectors, strings, arrays...
Operators are also used for logical operations and to calculate boolean expressions. For example, the greater than sign (>
) returns true
if the data on the left is greater than the data on the right side of the symbol.
var left := 5
var right := 3
print(left > right)
We also use operators to access data. For example, in GDScript, we use the dot to access properties and methods (member variables and member functions). To access the x position of a node, you would write position.x
. The dot operator is used to access the property named x
on the node's Vector2
property named position
.