9 ms·
I can't think of an example where let x = <something>; compiles but <something>; does not compile. I think all expressions are statements.
by hibbelig 4y ago
I can't think of an example where
let x = <something>;
compiles but
<something>;
does not compile. I think all expressions are statements.
- lmm 4y agoSome languages forbid "obviously pure" expressions like "0" as statements (since using them as a statement is probably a mistake).
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- bluepnume 4y agoRight. They're not mutually exclusive -- hence the "both, either, or neither"
- hibbelig 4y agoMy point was that there are four combinations, and "both, either, or neither" suggests that all four can happen. But actually, only three out of four can happen. It can be both a statement and an expression. Yes. It can be neither a statement nor an expression. Yes. It can be a statement but not an expression. Yes. But the case that it is an expression but not a statement: this case never happens.