# Return Early Pattern for Functions 3 hours sleep catching up to me

<%= @topic_view.topic.title %>
<%= @topic_view.topic.average_rating %> <%= @topic_view.topic.posts.count { |p| !!p.custom_fields['rating'] } %>

Tell us what’s happening:

i know it must be a simple answer but i cant figure it out, i’ve tried lots of different things but i’m not exactly sure what they are wanting

``````
// Setup
function abTest(a, b) {
// Only change code below this line
console.log()

// Only change code above this line

return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(2,2);
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36`.

You will need to check if the value of `a` or `b` is less than `0`. If so, then you can use the `return` statement and the value the instructions state when the checked condition is met. Remember, when a return statement is encountered, the function exits and does not execute any code after it. That is the point of this challenge.

so is it an if function? i tried ` if ` and no dice, i tried stuff with ` a || b < 0 ` but i cant figure out any of the right syntax

You might want to review how to create comparisons in JavaScript.

If I want to check if the value of a variable named `x` is equal to the number `2` and the value of another variable `y` is equal to the number `2`, I would write that as:

``````if (x === 2 && y ===2)
``````

shit that’s right ok, so what am i asking the computer to do once it determines if they are < 0 is this a switch thing or if function or… oh man i feel so dumb i need more sleep lol

You can use an if statement but you will use the `||` operator for the comparisons.

this is all i got am i even close?
``` if (a > 0 || b > 0) { return } ```

Well, since the instructions are wanting you to check if a or b are less than 0, what do you think?

that feeling when you eat dinner come back to coding and see your stupidest mistakes, here i was thinking i had the syntax all bleeped up.

thank you so much for your patience with me, i was able to clear the challenge.

1 Like