if/else
sentencias pueden ser encadenadas juntas para lógica compleja. Aquí está el pseudocódigo de múltiples encadenadas if
/ else if
enunciados:
if ( condition1 ) {
statement1
} else if ( condition2 ) {
statement2
} else if ( condition3 ) {
statement3
. . .
} else {
statementN
}
if
/ else if
sentencias para cumplir con las siguientes condiciones:
num < 5
- devolver "Tiny" num < 10
- devuelve "Small" num < 15
- devuelve "Medio" num < 20
- devuelve "Large" num >= 20
- devuelve "Enorme"
else
testString: 'assert(code.match(/else/g).length > 3, "You should have at least four else
statements");'
- text: Debes tener al menos cuatro if
declaraciones
testString: 'assert(code.match(/if/g).length > 3, "You should have at least four if
statements");'
- text: Debe tener al menos una declaración de return
testString: 'assert(code.match(/return/g).length >= 1, "You should have at least one return
statement");'
- text: testSize(0)
debería devolver "Tiny"
testString: 'assert(testSize(0) === "Tiny", "testSize(0)
should return "Tiny"");'
- text: testSize(4)
debería devolver "Tiny"
testString: 'assert(testSize(4) === "Tiny", "testSize(4)
should return "Tiny"");'
- text: testSize(5)
debe devolver "Small"
testString: 'assert(testSize(5) === "Small", "testSize(5)
should return "Small"");'
- text: testSize(8)
debe devolver "Small"
testString: 'assert(testSize(8) === "Small", "testSize(8)
should return "Small"");'
- text: testSize(10)
debe devolver "Medium"
testString: 'assert(testSize(10) === "Medium", "testSize(10)
should return "Medium"");'
- text: testSize(14)
debe devolver "Medium"
testString: 'assert(testSize(14) === "Medium", "testSize(14)
should return "Medium"");'
- text: testSize(15)
debe devolver "Large"
testString: 'assert(testSize(15) === "Large", "testSize(15)
should return "Large"");'
- text: testSize(17)
debería devolver "Large"
testString: 'assert(testSize(17) === "Large", "testSize(17)
should return "Large"");'
- text: testSize(20)
debería devolver "Huge"
testString: 'assert(testSize(20) === "Huge", "testSize(20)
should return "Huge"");'
- text: testSize(25)
debería devolver "Huge"
testString: 'assert(testSize(25) === "Huge", "testSize(25)
should return "Huge"");'
```