InterviewSolution
Saved Bookmarks
| 1. |
What is the difference between a statement and expression? |
|
Answer» A statement is an instruction that performs some operation, whereas, an expression evaluates a value. In SCALA, the basic control structures such as if and for-loop are expressions, as they RETURN value and it can be ASSIGNED to a variable. For example, val isOdd = if (num%2 != 0) true else false |
|