The Semicolon
A semicolon is used to denote the end of a statement. Semicolons are extremely important when expressing commands. When improperly used, you can run into extremely frustrating problems. You could easily be confused for hours trying to understand what someone is trying to say on the account of a semicolon. While semicolons are usually needed at the end of every statement, there are a few situations where a semicolon is improper. Some examples include if statements, loops, switch statements, and function definitions.
It is correct to write “my variable equals 15 (semicolon),” but it is not correct to write “if my variable is not equal to 15 (semicolon)” unless you did not wish the if statement to accomplish anything.
Another common trap is the infinite loop. A misplaced semicolon can cause such headaches which usually lead to a nice blue screen of death that involves a core dump of some sort. For example, “for (semicolon) (semicolon)” is a short way of writing an infinite loop. Be warned!