# Comparisons with the Logical Or Operator - why inclusive when using less than/greater than?!

Tell us what’s happening:
My code passes fine and I thought I understood what the Logical Or Operator was about, but I am confused with the wording of the example and the instructions here. Feels like I’m missing something.

The exercise is using < and > here, and yet I’m reading that it will be inclusive of the numbers after those angle brackets. If that is true, why are we not using <= and >= instead?

Am I misunderstanding something? Do the Less Than/Equal Than angle brackets behave differently when between these two pipe symbols (||) ? If not, why is it implied that they are behaving as Less/Greater Than Or Equal? Or is this a typo in the example and instructions, held over from a previous problem that does use <= / >= ?

Feels like I’m having a stroke! I tried to bold the relevant words below to draw attention to what I’m referring to - any insight appreciated. Thanks!

From the example:

``````if (num > 10) {
return "No";
}
if (num < 5) {
return "No";
}
return "Yes";
``````

will return `Yes` only if `num` is between `5` and `10` (5 and 10 included). The same logic can be written as:

``````if (num > 10 || num < 5) {
return "No";
}
return "Yes";
``````

Instructions:

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

Your code so far

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

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

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

testLogicalOr(15);
``````
``````  **Your browser information:**
``````

User Agent is: `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36`

Challenge: Comparisons with the Logical Or Operator

Link to the challenge:

Ok your post makes sense to me - thank you! I see that using >=/<= would return the wrong string.

I think it would’ve been helpful to show an extra example like yours to demonstrate this in the exercise (since it immediately follows the exercises on >= and <= , and the hints I received were too vague to help me understand WHY, even after my code passed because I followed the example format).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.