2 ms·
PS is meant for interactive use, which is why using the newline to terminate statements makes sense (and then they had to introduce another separator for multip
by userbinator 9y ago
PS is meant for interactive use, which is why using the newline to terminate statements makes sense (and then they had to introduce another separator for multiple statements on a line, along with a way to break up a statement across multiple lines.) JS is not.
The amount of PS "semicolon vs newline" discussions and articles (as well as those about JS's ASI) shows the downside of this additional complexity and the confusion it causes --- contrast this with C or C-derived languages like Java, where the only statement terminator is the semicolon (and block statements end with }.)
In general, you can see languages designed with interactive use as a primary goal (bash, cmd, PS, Python, ...) tend to also use a newline as a statement terminator.