Home »
MCQs »
Scala MCQs
What is the scope of a local variable in Scala?
50. What is the scope of a local variable in Scala?
- Whole program
- A method is it declared in
- Class/object containing it
- All of the above
Answer: B) A method is it declared in
Explanation:
Local variables of methods have scope restricted to that of methods in Scala.