The following table shows the operators defined in the Ginjo language. Note that logical and bitwise operators have a lower precedence than other arithmetic and relational operators.
Operator | Description |
---|---|
= | Assignment or equality operator, depending on context. When assigning a value to a variable it acts as an assignment operator. Inside an if statement it acts as an equality testing operator. (To determine whether two object instances are the same instance, use Object.ReferenceEquals) |
+ - * / | Standard mathematical operators. These can be combined with the assignment operator: +=, -=, *=, /= |
\ | Divides two numbers and returns an integer result. Can be combined with the assignment operator: \= |
|| | Performs short-circuiting inclusive logical disjunction on two expressions. If either or both expressions evaluate to true the result is true. If the first expression evaluates to true, then the second expression is not evaluated. |
&& | Performs short-circuiting logical conjunction on two expressions. The result is a Boolean value that represents whether the entire conjoined expression is true. If the first expression is false, the second expression is not evaluated. |
| | Performs a logical disjunction on two Boolean expressions, or a bitwise disjunction on two numeric expressions. In a boolean comparison the | operator always evaluates both expressions, including making function/property calls in those expressions. |
& | Performs a logical conjunction on two Boolean expressions, or a bitwise conjunction on two numeric expressions. In a boolean comparison the & operator always evaluates both expressions, including making function/property calls in those expressions. |
<< | Right-shift operator: shifts its first operand right by the number of bits specified by its second operand. Can be combined with the assignment operator. |
>> | Left-shift operator: shifts its first operand left by the number of bits specified by its second operand. Can be combined with the assignment operator. |
^ | Performs a logical exclusion on two Boolean expressions, or a bitwise exclusion on two numeric expressions. |
% | Divides two numbers and returns only the remainder. For example, the expression 14%4 evaluates to 2. |
! | Performs logical negation on a Boolean expression, or bitwise negation on a numeric expression. |
new | Creates an instances of a class. New calls the appropriate constructor of the specified class, passing the arguments specified. |
of |
Specifies the type parameter on a generic class. Usage example:
var:Dictionary(of String, Integer) myDict= new Dictionary(of String, Integer) |