I'm trying to understand how Scala works. So I typed this code.
var name = "eMmanuel"
val n = name.exists(_.isUpper)
name = "book"
Just looking at it, in my mind, I expect n
to be true
, I compile this and n: Boolean = true
, which is understandable. But in the console I see something strange.
name: String = book
n: Boolean = true
name: String = book
After compilation, first line of results from console tells me name: String = book
now, if name
is now String = book
why is n: Boolean = true
? Shouldn't this be false
? because after all, it's showing name: String = book
which obviously has no capital letter in it!