# Returning Boolean Values from Functions

see the code below

function isLess(a, b) {
// Fix this code
if (a < b) {
return true;
} else {
return false;
}
}

// Change these values to test
isLess(10, 15);

This how i fixed it

function isLess(a, b) {
// Fix this code
if (a ===b) {
return true;
} else {
return false;
}
}

// Change these values to test
isLess(10, 15);
the question now is i should not use any if or else statements

I know that but the question to fix is nit to use the if statement. i donâ€™t understand what you are trying to explain to me

its the most simple answers that always stump meâ€¦ i try to make it harder on myself lol

function isLess(a, b) {
// Fix this code
return a < b;

}

// Change these values to test
isLess(10, 15);

thank you so much i was having a very hard time with it too

@robelte Getting the answer from the forums is easy, but do you know why? Itâ€™s

``return a < b;``

Yeahâ€¦Killing hours on thisâ€¦

I put that answer in there and got it right, but I thought I was taking a shortcut by not using ===.

If â€śreturn a < b;â€ť is correct I feel the question is misleading. Why go on about comparisons and have a link to the earlier question: â€śComparison with the Equality Operatorâ€ť?

(Edit: Raised a GitHub issue)

1 Like

I was trying to use the switch function, but switch (a < b) doesnâ€™t work. Indeed this is a much more simple answer, just wish I would have found out by myself!

yup. this is me as well!

function isLess(a, b) {
// Fix this code

``````return a < b;
``````

}

// Change these values to test
isLess(10, 15);

solution:
function isLess(a, b) {
// Only change code below this line
return a<b;
{

``````return false;
``````

}
// Only change code above this line

}
isLess(10, 15);