Notes
In Apex, the else if
statement is an extension of the basic if
statement and is used when you have multiple conditions to check. It allows you to specify additional conditions to be evaluated if the initial if
condition is false. The syntax for the else if
statement is as follows:
if (condition1) {
// Code to be executed if condition1 is true
} else if (condition2) {
// Code to be executed if condition1 is false and condition2 is true
}
Here's an example:
Integer num = 12;
if (num > 15) {
System.debug('The number is greater than 15.');
} else if (num > 10) {
System.debug('The number is greater than 10 but not greater than 15.');
}
Output: The number is greater than 10 but not greater than 15.
Video
Video does not exists.