The if statement syntax is as follows:
if condition {
doSomething()
}
OR
if(condition) {
doSomething()
}
OR (if only one statement is present in the code block):
if condition:
doSomething()
The if statement may be followed by a matching "else" statement or an "else if" statement, as follows:
if condition {
doSomething()
}
else {
doSomethingElse()
}
OR
if condition {
doSomething()
}
else if condition2 {
doSomethingElse()
}
else {
doSomethingMore()
}