Overview syntax problem: And



Oops, try again. There was a problem with your syntax.
SyntaxError: Unexpected token else

var hungry = true;
var foodHere = true;

var eat = function() {
    if (hungry && foodHere); {
        return true;
    } else {
        return false;

I dont know whats wrong here, can someone please help?



You need to remove that semi-colon. It's acting as a suppressor there.

I hope this helps! :wink:


you also don't need the else or either of the returns. just the if statement.


Ahhh that works, thank you so much!


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