News for hackers. Stuff that matters.
Re:Statements vs. Expressions by hardwaregeek on Thursday July 14, 2022 @08:50AM (#32095385)
This is why taking a basic programming language course is pretty important. I never remembered the difference until I had to represent both in an AST. You can teach it without talking about ASTs or interpreters, but it's teaching without any context or motivation, thereby making it harder to learn.

I do think mandatory semicolons make the distinction a little easier. If it has a semicolon, it's probably a statement. And for most C-style languages if it has curly braces, it's probably a statement too. Otherwise it's an expression.

There are no comments on this comment yet.