if/else يمكن ربط عبارات if/else معًا لمنطق معقد. هنا هو pseudocode متعددة متعددة السلاسل if / else if العبارات: إذا ( condition1 ) {
statement1
} آخر إذا ( condition2 ) {
statement2
} آخر إذا ( condition3 ) {
statement3
. . .
} آخر {
statementN
}
if / else if عبارات تفي بالشروط التالية: num < 5 - return "Tiny" num < 10 - عودة "صغير" num < 15 - عودة "متوسطة" num < 20 - عودة "كبير" num >= 20 - return "Huge" else البيانات
testString: 'assert(code.match(/else/g).length > 3, "You should have at least four else statements");'
- text: يجب أن يكون لديك أربعة على الأقل if البيانات
testString: 'assert(code.match(/if/g).length > 3, "You should have at least four if statements");'
- text: يجب أن يكون لديك بيان return واحد على الأقل
testString: 'assert(code.match(/return/g).length >= 1, "You should have at least one return statement");'
- text: يجب أن ترجع testSize(0) "صغيرة"
testString: 'assert(testSize(0) === "Tiny", "testSize(0) should return "Tiny"");'
- text: يجب أن ترجع testSize(4) "صغيرة"
testString: 'assert(testSize(4) === "Tiny", "testSize(4) should return "Tiny"");'
- text: testSize(5) إرجاع "صغير"
testString: 'assert(testSize(5) === "Small", "testSize(5) should return "Small"");'
- text: testSize(8) إرجاع "صغير"
testString: 'assert(testSize(8) === "Small", "testSize(8) should return "Small"");'
- text: testSize(10) إرجاع "Medium"
testString: 'assert(testSize(10) === "Medium", "testSize(10) should return "Medium"");'
- text: testSize(14) إرجاع "Medium"
testString: 'assert(testSize(14) === "Medium", "testSize(14) should return "Medium"");'
- text: testSize(15) إرجاع "كبير"
testString: 'assert(testSize(15) === "Large", "testSize(15) should return "Large"");'
- text: testSize(17) إرجاع "كبير"
testString: 'assert(testSize(17) === "Large", "testSize(17) should return "Large"");'
- text: testSize(20) إرجاع "ضخم"
testString: 'assert(testSize(20) === "Huge", "testSize(20) should return "Huge"");'
- text: testSize(25) إرجاع "ضخم"
testString: 'assert(testSize(25) === "Huge", "testSize(25) should return "Huge"");'
```