September 2019
Intermediate to advanced
462 pages
11h 3m
English
Dots and parenthesis are common in code we write, but on many occasions leaving those out can make the code less noisy and easier to follow. For example, the following is familiar code in Java:
| | //Java |
| | if(obj instanceof String) { |
Imagine Java had insisted that we write if(obj.instanceOf(String)) {—what a clutter that would have been. Instead, we used a nice syntax if(obj instanceof String) {—that’s much easier to read, and it uses what is called the infix notation, where an operator is infixed or implanted in the middle of its operands. That syntax is nice, but in Java such fluency is limited to predefined operators. In Kotlin you can use the infix notation—that is, leave out dots and parenthesis—for your own ...
Read now
Unlock full access