For the for-yield construct, is the scope separate between for-body and yield-body?
No, because for-yield shares the same scope, even though they are within separate curly braces.
Yes, because the for section does not expose its scope.
Yes and no. It is different depending on the for construct and what it does.
Yes, because they are within different curly braces. Example: yield-body has access to the e variable from the for-body
e
val a = Array(1, 2, 3, 4, 5) for { e <- a if e > 2 } yield e