Question

Kotlin Grammar-Precedence: - gives the operator precedence table for Kotlin, including the operators with a type on the right-hand side, :, as and as?, which have precedence in between the multiplication and prefix operators.

Is there a reason for giving them that particular precedence? I can't offhand think of a situation where it would be necessary/advantageous; what am I missing?

Was it helpful?

Solution

We wanted to avoid parentheses in cases where something has to be cast and then added/checked for "in" etc

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top