← JavaScript

else if Statements

Checks another condition only when the previous if or else if condition was false.

Understanding else if Statements in JavaScript

What it does: else if is exactly how you check another condition. As soon as one condition is true, the rest are skipped. 'else if' must be written as two separate words with a space. You can have as many else if blocks as needed in a chain. Just like if, else if needs a condition wrapped in ( ). JavaScript is case-sensitive, so 'else' must be lowercase. Like if, else if wraps its code in { }. The block runs when this condition is true and the earlier one wasn't.

Common mistakes: 'else if' needs a space - 'elseif' is not valid syntax. 'else' must be lowercase - a capital E causes an error.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 11–25) and word search (Modules 1–29).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Does else if check another condition when the first if was false?
YesNo
Matches
} elseif (score >= 70) { ... }
↓
Wrong - 'else if' needs a space between the words
Applying
Meanings
Term
else if
Meaning
Checks another condition only when the previous if or else if condition was false.
Practice
let score = 75;
Testing
Gaps
} (score >= 70) {
Check Answer
Spots
1} elseif (score >= 70) {
2if (score >= 90) {

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Cheetah' badge — Savannah Sprinter, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Does else if check another condition when the first if was false?
A. No
B. Yes ✓
else if only runs its check if the earlier condition was false.
2. Is 'elseif' with no space valid JavaScript syntax?
A. No ✓
B. Yes
'else if' must be written as two separate words with a space.
3. Can you chain multiple else if blocks together?
A. Yes ✓
B. No
You can have as many else if blocks as needed in a chain.
4. Does else if need its own condition in parentheses?
A. No
B. Yes ✓
Just like if, else if needs a condition wrapped in ( ).
5. Will only one block in an if/else if chain run?
A. Yes ✓
B. No
Once one condition is true, the rest of the chain is skipped.

Match the Pairs

} else if (score >= 70) { ... } → Checks this condition only if the earlier if was false
} else if (age < 18) { ... } → Runs its block only if age < 18 and the first if was false
Adds another condition to check after an if → else if
Only one block in a chain of these runs → if / else if / else if
} elseif (score >= 70) { ... } → Wrong - 'else if' needs a space between the words
} Else if (age < 18) { ... } → Wrong - 'else' must be lowercase

Key Term

else if
Checks another condition only when the previous if or else if condition was false.

Fill in the Blanks

1. } else if (score >= 70) {
Hint: Type the two keywords that check another condition after if.
2. if (age < 13) { } else if (age < 18) {
Hint: Type the age value used in the second condition.
3. if (n === 1) { } else if (n === 2) {
Hint: Type the number checked in the second condition.
4. } else if (temp > 30) {
Hint: Type the keyword that comes after 'else' to check another condition.
5. } else if (level === 2) {
Hint: Type the keyword that comes before 'if' to check another condition.

Spot the Error

Question 1
A } elseif (score >= 70) {
B if (score >= 90) {
C }
Line A — 'else if' needs a space - 'elseif' is not valid syntax.
Question 2
A if (age < 13) {
B } Else if (age < 18) {
C }
Line B — 'else' must be lowercase - a capital E causes an error.
Question 3
A if (n === 1) {
B }
C } else If (n === 2) {
Line C — 'if' must be lowercase - a capital I causes an error.
Question 4
A if (temp > 30) {
B console.log("Hot");
C }
D } else if temp > 20) {
Line D — The else if condition needs an opening parenthesis.
Question 5
A if (level === 1) {
B } else if (level === 2 {
C console.log("L1");
D }
Line B — The else if condition is missing a closing parenthesis.

Student with a class code? Join your class →