if/else instruções podem ser encadeadas para lógica complexa. Aqui está o pseudocódigo de várias instruções encadeadas if / else if : if ( condição1 ) {
statement1
} else if ( condição2 ) {
statement2
} else if ( condição3 ) {
statement3
. . .
} outro {
statementN
}
if / else if instruções preencherem as seguintes condições: num < 5 - return "Tiny" num < 10 - retorna "Pequeno" num < 15 - return "Medium" num < 20 - retorna "Grande" num >= 20 - retornar "Enorme" else declarações
testString: 'assert(code.match(/else/g).length > 3, "You should have at least four else statements");'
- text: Você deve ter pelo menos quatro declarações if
testString: 'assert(code.match(/if/g).length > 3, "You should have at least four if statements");'
- text: Você deve ter pelo menos uma declaração de return
testString: 'assert(code.match(/return/g).length >= 1, "You should have at least one return statement");'
- text: testSize(0) deve retornar "minúsculo"
testString: 'assert(testSize(0) === "Tiny", "testSize(0) should return "Tiny"");'
- text: testSize(4) deve retornar "minúsculo"
testString: 'assert(testSize(4) === "Tiny", "testSize(4) should return "Tiny"");'
- text: testSize(5) deve retornar "Small"
testString: 'assert(testSize(5) === "Small", "testSize(5) should return "Small"");'
- text: testSize(8) deve retornar "Small"
testString: 'assert(testSize(8) === "Small", "testSize(8) should return "Small"");'
- text: testSize(10) deve retornar "Medium"
testString: 'assert(testSize(10) === "Medium", "testSize(10) should return "Medium"");'
- text: testSize(14) deve retornar "Medium"
testString: 'assert(testSize(14) === "Medium", "testSize(14) should return "Medium"");'
- text: testSize(15) deve retornar "Large"
testString: 'assert(testSize(15) === "Large", "testSize(15) should return "Large"");'
- text: testSize(17) deve retornar "Large"
testString: 'assert(testSize(17) === "Large", "testSize(17) should return "Large"");'
- text: testSize(20) deve retornar "Enorme"
testString: 'assert(testSize(20) === "Huge", "testSize(20) should return "Huge"");'
- text: testSize(25) deve retornar "Enorme"
testString: 'assert(testSize(25) === "Huge", "testSize(25) should return "Huge"");'
```