object Example extends App {
val result = for {
a <- Some(22.5)
b <- Some(Map("t1" -> 10.0, "t2" -> 22.0))
c <- Some(Map("t1" -> 10.0, "t2" -> 22.0))
(aa, bb) <- b
d <- Map("t1" -> 10.0, "t2" -> 22.0).get(aa)
e <- Map("t1" -> 10.0, "t2" -> 22.0).get(aa)
f <- Some(123123.213)
g <- Some(123123.232)
h <- Some(234234.22)
i = g * h
} yield 10
}
//scala: type mismatch;
//found : scala.collection.immutable.Iterable[Int]
//required: Option[?]
//(aa, bb) <- b
//^
问问题
80 次