Having trouble figuring out Comparisons with the Logical Or Operator challenge

Having trouble figuring out Comparisons with the Logical Or Operator challenge
0

#1

// Only change code below this line

if (val>=0 || val<10 )
{
return “Outside”;
}

// Only change code above this line
return “Inside”;
}

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

#2

#3

I have renamed your topic title to reflect which challenge you are having trouble with.

The above if statement has two conditions separated by the OR operator. Currently, your code is checking if value is greater or equal to 0 OR val is less than 10. Remember the OR operator only needs one condition to be true. In this case, the val >= 0 evaluates to true, because 15 > 0.

The instructions state the following:

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

That means you need to write an if statement with 2 conditions separated by the OR operator. The first condition should check if val is less than 10. The second condition should check if val is greater than 20.

#4

Or you can consider the AND operator

#5

True, but the challenge is expecting the use of the OR operator.