August 2017
Intermediate to advanced
440 pages
10h
English
Kotlin has a predefined set of operators with fixed symbolic representation (such as +, and *) and fixed precedence. Most of the operators are translated directly into method calls; some are translated into more complex expressions. The following table contains a list of all the operators available in Kotlin:
|
Operator token |
Corresponding method/expression |
|
a + b |
a.plus(b) |
|
a - b |
a.minus(b) |
|
a * b |
a.times(b) |
|
a / b |
a.div(b) |
|
a % b |
a.rem(b) |
|
a..b |
a.rangeTo(b) |
|
a += b |
a.plusAssign(b) |
|
a -= b |
a.minusAssign(b) |
|
a *= b |
a.timesAssign(b) |
|
a /= b |
a.divAssign(b) |
|
a %= b |
a.remAssign(b) |
|
a++ |
a.inc() |
|
a-- |
a.dec() |
|
a in b |
b.contains(a) |
|
a !in b |
!b.contains(a) ... |
Read now
Unlock full access