commenting out the second if statement returns a failed test. The test should pass as the commented out if statement has no bearing on the return statement.
See original GitHub issueChallenge Comparisons with the Logical And Operator has an issue.
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.101 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
function testLogicalAnd(val) {
// Only change code below this line
if (val<=50 && val>=25) {
//if (val) {
return "Yes";
}
// Only change code above this line
return "No";
}
// Change this value to test
testLogicalAnd(10);
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
How should one comment an if-else structure? [duplicate]
If it is needed to comment if else statements, I prefer to describe the case what made the code reach that point. Especially...
Read more >Error with IF connecting to IFS statement
Hey! Im having an error with an excel task. So im got a RANDBETWEEN(1,10) and if said.
Read more >Curious Perversions in Information Technology - The Daily WTF
[quote user="sys<in"] Another possibility is that the value of I has no bearing in the commented-out parts, but the condition else can only...
Read more >Google C++ Style Guide
If the #include was replaced with forward decls for B and D , test() would call ... Variables needed for if , while...
Read more >IF Statement Excel – If Function Examples - freeCodeCamp
If you are analysing data in Excel and need to set the value of a cell conditionally, you can use an IF statement...
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
Evidently, the code counting the number of
if
s does not pay any regard to the fact if it is commented or not, it’s just plain old counting the number ofif
s present inside your code.EDIT: Even writing something as stupid as
// what if
triggers the test case.EDIT2: Aha! As i thought, the statement for the test case is:
assert(code.match(/if/g).length === 1, 'message: You should only have one <code>if</code> statement');
Which is basically just counting the number of
if
s in your code. Maybe we could improve it to disregardif
s inside a commented block.A PR to fix this will be raised against #11360