I came to code:
scala> val a = 0 | 1
a: Int = 1
scala> val a = 0 | 1 | 2
a: Int = 3
scala> val a = 0 | 1 | 2 | 3
a: Int = 3
scala> val a = 0 | 1 | 2 | 3 | 4
a: Int = 7
The only result I expected from the | operator is the result of the first command. I see it behaves like a logic or and also it adds elements in the second command.
Could someone explain the working of the | operator using integers as operators?