3 ms·
That example has nothing to do with whether semicolons are omitted or not; the rule that you need to know is don’t ever put a newline between the “return” keywo
by jacobolus 16y ago
That example has nothing to do with whether semicolons are omitted or not; the rule that you need to know is don’t ever put a newline between the “return” keyword and the value to be returned, but whether you add semicolons at the end of what you want to make a statement makes absolutely no difference in this case.
In other words, whether you write
return
foo;
or
return
foo
the result is the same: an empty return, completely ignoring the foo bit.
- drivebyacct2 16y agoRight, but if it wasn't "autoinserting" semicolons, the behavior would be different.
- jacobolus 16y agoThat doesn’t have any bearing on whether human programmers should add unnecessary semicolons to lines where there is no such ambiguity.