Operators
Arithmetic
Section titled “Arithmetic”| Operator | Supported types |
|---|---|
+ | Int, Long, Double, Decimal, String |
-, * | Int, Long, Double, Decimal |
/ | Int (truncating), Long (truncating), Double, Decimal |
% | Int, Long |
No implicit widening. Both sides must be the same numeric type.
String + <any> is valid: the right-hand side is coerced to String automatically.
"adult (age " + age + ")" // age is an Int. Coerced automaticallyComparison
Section titled “Comparison”==, !=, <, <=, >, >=. Work on all numeric types and on Bool/String
for equality.
Logical
Section titled “Logical”&&, || (both short-circuit), ! (unary).
- (numeric negation), ! (boolean negation).