The procedure for calculating bitwise operators in Kotlin

I can not find information on the procedure for calculating bitwise operators in Kotlin. Is it the same as in Java, or are they computing from left to right without any priority?

+4
source share
1 answer

and, or xorand other infix functions for bitwise operations are not operators as such, and their execution order coincides with the order of other infix functions, i.e. left to right, so these two lines are equivalent:

a or b and c or d and e

(((a or b) and c) or d) and e

Also note that the priority of infix functions is lower than that of operators:

1 + 2 and 3 + 4

(1 + 2) and (3 + 4)
+4
source

Source: https://habr.com/ru/post/1689381/


All Articles