The general form of an if statement is like this (though the
layout may be different, according to local conventions or taste):
if (test) { statements; ... } else { statements; ... }
The main variation is to leave out the else part, which
implicitly means "... else do nothing":
if (test) { statements; ... }
There is no semicolon at the end of the if (test) line. That indicates that the
statement continues on the next few lines, i.e. the block is attached to the
if. There is also no semicolon at the end, after the closing bracket, because
any statement which has a bracketed block of code is taken to end at the
closing bracket.