Freecodecamp: Comparisons with the Logical Or Operator

Created on 23 Feb 2016  路  16Comments  路  Source: freeCodeCamp/freeCodeCamp

Challenge Comparisons with the Logical Or Operator has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

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

  if (val <= 10 || val >= 20) {
    return "Outside";
  }

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

// Change this value to test
myTest(15);

Without the numbers 10 and 20 being inclusive, the code runs but there seems to be a problem when you include them and run the solution. Maybe the instructions should be different.

discussing

Most helpful comment

This is very confusing wording. This needs to be changed.

Also this doesn't work for me...
function test(val) {
// Only change code below this line
if(val > 20 || val < 10) {
return "Outside";
}

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

// Change this value to test
test(15);

All 16 comments

Combine the two if statements into one statement which returns "Outside" if val is not between 10 and 20, inclusive. Otherwise, return "Inside".

So it should be interpreted to mean return "Outside" if val is not between 10 and 20, along with val not being 10 or 20.

@FreeCodeCamp/issue-moderators is the wording fine, or is there sufficient potential for confusion (as evidenced by this issue)?

The instructions say that you are suppose to exclude 10 and 20 when returning outside.

...returns "Outside" if val is not between 10 and 20, inclusive.

I haven't seen anyone have an issue with this yet.

My wife just went through this challenge last week. She was unbelievably frustrated by it, as it can prove very tricky for those not taught to think logically and speak literally. But once she understood what it meant, she agreed on the phrasing being right and specific...
It could be worded in an easier manner but I do not personally believe we should make it so. This is a language class, and students should be kept to a standard of excellence.

If nobody understood it, maybe there we would have a problem. But since it's quite simple once you know what the problem requires, I'd say not to change it.

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

if (val > 20 || val < 10) {
return "Outside";
}

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

// Change this value to test
myTest(15);

This is the code that managed to run and in that case 20 and 10 are not inclusive.

@tmusimbi they are, just seen from the opposite angle... "it's one of us" = "it's not one of them" sort of logic.

From that perspective, it seems to make sense... I had not thought about it that way. Thanks

This is very confusing wording. This needs to be changed.

Also this doesn't work for me...
function test(val) {
// Only change code below this line
if(val > 20 || val < 10) {
return "Outside";
}

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

// Change this value to test
test(15);

@RazzaFrazza your code works well on my machine. Try resetting your challenge and trying the same code again.

The phrasing is confusing, but that's part of the point of a math exercise, right?

I too am having difficulty with the wording. Is the data range of Inside supposed to be 10..20, with all other values evaluating to Outside? If yes, why does my code not work?

function test(val) {
// Only change code below this line
  if(val > 20 || val < 10) {
    return "Outside";
  } else {
      return "Inside";
  }
}

The logic is: anything greater than 20, or anything less than 10 should evaluate to Outside. All other values should evaluate to Inside. Where did I go wrong? For the record I am using Firefox 44.0.2 on El Cap. Cheers!

this is the correct answer :

removed solution by mod

@RazzaFrazza I had the same problem as you had..two problems: it could be your browser (I used Mozilla and didn't worked; switched to Chrome and all good) or you just need to refresh your current browser.

I actually found this bug while searching for what was meant by the in range language added here, given that it was different from the language before. Also, to the husband who helped his wife, maybe having your wife participate in these conversations would be good as so many of this issues are cross-cultural/diversity issues.

Can anyone help....I'm trying to execute this challenge too but I'm falling to get it right.

function test(val) {
// Only change code below this line
if(val > 20 || val < 10) {
return "Outside";
}

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

// Change this value to test
test(15);

Here is my code is it same for your code . Please check your browser version and refresh the page . After that things you may use this code.Hopefully is helpfull .

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

if (val > 20 || val < 10) {
return "Outside";
}

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

// Change this value to test
testLogicalOr(15);

Challenge Comparisons with the Logical Or Operator has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

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

  if (val < 10 || val > 20) {
    return "Outside";
  }

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

// Change this value to test
myTest(15);

Without the numbers 10 and 20 being inclusive, the code runs but there seems to be a problem when you include them and run the solution. Maybe the instructions should be different.

Without the numbers 10 and 20 being inclusive, the code runs but there seems to be a problem when you include them and run the solution.

@AnirudhWT The code does not work when you include them, because that is the point of the challenge. There is nothing wrong with the current instructions. Feel free to visit our forum to discuss this further.

Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jurijuri picture jurijuri  路  3Comments

MelissaManning picture MelissaManning  路  3Comments

Tzahile picture Tzahile  路  3Comments

vaibsharma picture vaibsharma  路  3Comments

DaphnisM picture DaphnisM  路  3Comments