January 2018
Intermediate to advanced
434 pages
14h 1m
English
The or function compares the corresponding bits of two values. If either of the two bits is 1, it gives 1, and it gives 0 if not.
Consider this example:
fun main(args: Array<String>) { val a=2 val b=3 print(a or b)}
The following is the output:
3
Here's the explanation of the preceding example:
2 = 10 (Binary format)
3 = 11 (Binary format)
Bitwise OR of 2 and 3 that is
in binary
10 OR 11
11 = 3 (Decimal format)
Read now
Unlock full access