Basic Comparisons with the Logical And Operator

Tell us what’s happening:

I dont understand why it dose not return yes can some help?

Your code so far

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

if (val >= 50 && val <= 25) {
  return "Yes";
return "No";

// Change this value to test

You have set an impossible condition. Maybe you mean OR, not AND?

It can’t return yes
Let’s see your statement
The first part is val >= 50, so “val is greater than or equal to 50”
The second part is val <= 25, so “val is less than or equal to 25”
You have && which is “AND”
In total we have “val is greater than it equal to 50 AND val is less than or equal to 25”
It will always be false, there are no numbers for which it is true.

Read this:
If value is greater than 50 AND if value is less than or equal to 25, then return ‘YES’.

How can a value be greater than 50 AND less than 25 at the same time ? :smile:
&& means AND
|| means OR

1 Like

aa ofc probably time to take a break xD thank you for quick answer.