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 (condition) {
	// if condition is true, this block of code will be executed
} else if (condition2) {
	// if condition2 is true, this block of code will be executed
} else {
	// neither condition nor condition2 is true
}