0 votes
in Scala Constructs by

What is an Expression in Scala? What is a Statement in Scala? Difference between Expression and Statement?

1 Answer

0 votes
by

Expression: Expression is a value that means it will evaluate to a Value. As an Expression returns a value, We can assign it to a variable. Example:- Scala’s If condition, Java’s Ternary operator. Statement: Statement defines one or more actions or operations. That means Statement performs actions. As it does not return a value, we cannot assign it to a Variable. Example:- Java’s If condition.

Related questions

0 votes
asked Mar 21, 2021 in JavaScript by rajeshsharma
0 votes
asked Sep 10, 2022 in Scala Constructs by Robin
...