Chaining If Else Statements
if/else
statements can be chained together for complex logic. Here is pseudocode of multiple chained if
/ else if
statements:
if (condition1) {
statement1
} else if (condition2) {
statement2
} else if (condition3) {
statement3
. . .
} else {
statementN
}
Write chained if
/else if
statements to fulfill the following conditions:
num < 5
- return Tiny
num < 10
- return Small
num < 15
- return Medium
num < 20
- return Large
num >= 20
- return Huge
Tests
- Waiting: 1. You should have at least four
else
statements - Waiting: 2. You should have at least four
if
statements - Waiting: 3. You should have at least one
return
statement - Waiting: 4.
testSize(0)
should return the stringTiny
- Waiting: 5.
testSize(4)
should return the stringTiny
- Waiting: 6.
testSize(5)
should return the stringSmall
- Waiting: 7.
testSize(8)
should return the stringSmall
- Waiting: 8.
testSize(10)
should return the stringMedium
- Waiting: 9.
testSize(14)
should return the stringMedium
- Waiting: 10.
testSize(15)
should return the stringLarge
- Waiting: 11.
testSize(17)
should return the stringLarge
- Waiting: 12.
testSize(20)
should return the stringHuge
- Waiting: 13.
testSize(25)
should return the stringHuge
/** * Your test output will go here */