January 2018
Intermediate to advanced
434 pages
14h 1m
English
The xor function compares the corresponding bits of two values. If the corresponding bits are the same, it gives 0, and if they are different, it gives 1.
Look at this example:
fun main(args: Array<String>) { val a=2 val b=3 print(a xor b)}
Given is the output:
1
Here's the explanation:
2 = 10 (Binary format)
3 = 11 (Binary format)
Bitwise XOR of 2 and 3
in binary
10 XOR 11
01 = 1 (Decimal format)
Read now
Unlock full access