samedi 24 janvier 2015

Scala's || and | operators

I noticed something today. Scala has the usual OR ||, but also the |.


My first thought was that the | was a strict OR. So true | true, will evaluate to false. But,



val x = true
x: Boolean = true
val y = true
y: Boolean = true
x || y
res4: Boolean = true
x | y
res5: Boolean = true


What is the | operator for? Is it just an alias?


Aucun commentaire:

Enregistrer un commentaire