Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
FeepingCreature
· 4y ago · 0 comments
So 'if', 'for', 'while' are not statements?
Comments
[–]
lmm
4y ago
Not on their own. A full if, for or while (with the conditions and body) is usally a statement, and might be an expression in some languages.
[–]
FeepingCreature
OP
4y ago
The body is also not terminated by a semicolon.
`while (true) { puts("Hello World\n"); };`
[–]
lmm
4y ago
What you've written there does compile though, which was the original condition :).
[–]
FeepingCreature
OP
4y ago
I get the joke, but it's two statements, not one. (while and ;)
[–]
shikoba
4y ago
In JavaScript no. But in some languages it can be.
[–]
teddyh
4y ago
No. Those are syntactic elements.