If-else syntax

The if-else statement is a control structure that executes different program parts depending on a condition. If the condition is met, the program part from the if-branch is executed, if the condition is not met, the else part is executed.

if (condition)
	// if condition is true, this block of code will be executed
if (condition) {
	// if condition is true, this block of code will be executed
} else {
	// if condition is false, this block of code will be executed
}
if (conditionFirst) {
	// if first condition is true, this block of code will be executed
} else if (conditionSecond) {
	// if second condition is true, this block of code will be executed
} else {
	// neither first condition nor second condition is true
}