hi all,
I’m a newcomer, when I read found " for / yield " may have problem, for example:
following code:
scala> val u = for ( s<- “hello” ) yield s.toUpper;
the result is :
u: String = HELLO
the result is right. but when I add if guard:
scala> val u = for ( s<- “hello” if s != ‘e’ ) yield s.toUpper;
the result is:
u: String = hllo
so, why? The result should be “HLLO”, because yield has toUpper them.
could any one help me?
thank you advanced:wink: