[BUG] - Formatting required in `Introducing Else If Statements`
See original GitHub issueDescribe your problem and how to reproduce it:
The tests appear to require specific (albeit conventionally correct) formatting in order for the code to pass. This code block, provided by a user, did not pass:
function testElseIf(val) {
if (val > 10) {
return "Greater than 10";
} else if (val < 5) {
return "Smaller than 5";
} else {
return "Between 5 and 10";
}
}
testElseIf(7);
However, if I ran the formatter with Ctrl
+Alt
+F
, the resulting formatted code did pass:
function testElseIf(val) {
if (val > 10) {
return "Greater than 10";
} else if (val < 5) {
return "Smaller than 5";
} else {
return "Between 5 and 10";
}
}
testElseIf(7);
Add a Link to the page with the problem:
Basic JavaScript - Introducing Else If Statements
Tell us about your browser and operating system:
- Browser Name: Chrome
- Browser Version: 85.0.4183.83
- Operating System: Windows 10 v1909
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Introducing Else If Statements bug? - The freeCodeCamp Forum
Tell us what's happening: So freecodecamp won't accept my answer because it says I don't have two else statements?
Read more >Formatting of if Statements - Stack Overflow
I find this: if( true ) { DoSomething(); } else { DoSomethingElse(); }. better than this: if( true ) DoSomething(); else DoSomethingElse();.
Read more >Related "if/else if" statements should not have the same ...
A chain of if / else if statements is evaluated from top to bottom. At most, only one branch will be executed: the...
Read more >if / else errors - learn how to fix these - Codecademy
In the particular code example above, if the program execution has reached the else statement it means that: a < b returned false...
Read more >IF, ELSE, ELSE IF Statement in R - Guru99
Note: Make sure you correctly write the indentations. Code with multiple conditions can become unreadable when the indentations are not in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @yashgupta18. We typically accept PRs in the order we receive them, so this will be open until we get a working PR.
Hi, i am a first timer. Is the issue still open?