question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Comments are not ignored?

See original GitHub issue

Challenge Comparisons with the Logical And Operator has an issue. User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 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) {

      return "Yes";
//     
  }

  // Only change code above this line
  return "No";
}

// Change this value to test
testLogicalAnd(10);

I commented out the second if statement and did not pass, this test failed ‘You should only have one if statement’

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);

Removing the if statement all together passed the test:

function testLogicalAnd(val) {
  // Only change code below this line

  if (val<=50 && val>=25) {

      return "Yes";

  }
  // Only change code above this line
  return "No";
}
// Change this value to test
testLogicalAnd(10);

Not sure if this is intended behavior but it felt like a bug, commenting out the second if statement would work under normal circumstances. Thanks.

(Bouncey edited for code formatting)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:19 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
raisedadeadcommented, Dec 8, 2017

Although this is the oldest, closing in favor of https://github.com/freeCodeCamp/freeCodeCamp/issues/11360 which has more relevant technical discussion.

0reactions
raisedadeadcommented, Dec 11, 2017

Ah, sorry I meant to close this in favor of https://github.com/freeCodeCamp/freeCodeCamp/issues/15134

Read more comments on GitHub >

github_iconTop Results From Across the Web

Comment: the interpreter is not ignoring comments
I commented out the line with the .push method with a "#", but the interpreter still saw the old code and said my...
Read more >
How to fix HTML file comments not being ignored by Webpack ...
7.1), since Webpack Dev Server doesn't seem to ignore comments in source HTML files. It tries to require resources from commented sections of ......
Read more >
eslint-disable ... comments are not ignored anymore by line ...
What actually happened? Please include the actual, raw output from ESLint. I get an error "3:22 error Expected comment to be above code...
Read more >
Comment lines in commit-messages are not ignored
I have a commit template which is inserted automagically in version 2059. I like that, thank you! However, my template includes lines ...
Read more >
C++ Comments - W3Schools
Any text between // and the end of the line is ignored by the compiler (will not be executed). This example uses a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found