Loading...
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
Tests multiple conditions in sequence. Once a condition is true, its block executes and the rest are skipped.
if (marks >= 90) {
grade = 'A';
} else if (marks >= 80) {
grade = 'B';
} else if (marks >= 70) {
grade = 'C';
} else if (marks >= 60) {
grade = 'D';
} else {
grade = 'F';
}Conditions are checked top to bottom. The first match executes, and the rest are skipped entirely. The else at the end is the fallback for when no condition matches.