Operators
Others
Besides mathematical, comparison, and logical operators, it is also possible to use a series of additional operators that do not fit into the traditional categories but are widely used to complement the code.
Other supported operators:
|
: Applies a filter to a variable.
Example of use:
~
: Concatenates two values, usually strings.
Example of use:
.
: Accesses a property or method of an object, or an element of an array.
Example of use:
[]
: Accesses a specific element in a sequence (array).
Example of use:
?:
: Ternary operator. Returns the value on the left if it is defined and not null; otherwise, returns the value on the right.
Example of use:
??
: Checks if a value is defined and not null; otherwise, returns a default value.
Example of use: