Why do we have the distinction between statements and expressions in most programming languages?
For example, in Java, assuming f and g return ints, this still won't compile because it's a statement and statements don't return values.
// won't compile
int i = if (pred) {
f(x);
} else {
g(x);
}
but in Scala, it's very happy with treating if as an expression.
// compiles fine
val i: Int = if (pred) f(x) else g(x)
So if there's no problem treating an if statement as an expression, why was there a distinction in the first place?