Semicolons
Anyone know if they're "unnecessary but allowed", or if I'm going to have syntax errors on like 60% of my lines of code?
Posted Jun 2, 2014, 8:44 PM UTC
35
Anyone know if they're "unnecessary but allowed", or if I'm going to have syntax errors on like 60% of my lines of code?
Posted Jun 2, 2014, 8:44 PM UTC
According to the documentation, you MUST use semicolons when writing separate statements on a single line. Not sure then how it would handle a semicolon on a line with one statement.
Just read this in the language guide:
So yes, you can type semicolons if it's more comfortable to you - Swift won't complain.
I'm sure it will eventually be considered bad style though.
Be careful what you say! JavaScript tools and JSHint niggle you for the semicolon, but a lot of Node applications are forgoing semicolons entirely.
A reverse opinion, but a valid point. These scripting languages don't need semicolons as long as the programmer knows WHEN THEY NEED THEM.
If Apple doesn't use semicolons in their documentation neither will most developers.