finalGrade() exercise

hi all first question here thanks in advance! having trouble figuring out what i’ve done wrong here, please help.

There should be no clause for the else.

should be

else {
 whatever logic you want to run.
}
1 Like

I’m sorry i don’t understand. Your example of how it should look, looks like what i have there. Can u possibly break it down a bit further?

@botosaui

Look at @alangervin3193293788’s example

else {
 whatever logic you want to run.
}

Yours looks like this in comparison:

else (condition) {
 whatever logic you want to run.
}

If you can spot the difference you’ve solved the error.

ohhhhhhhhhhhhhhhhhh ok, thank you. sorry if that was a dumb question but you guys really helped. thanks

one more thing. so the reason its wrong is because i was telling the computer what it already knew?

No such thing as a dumb question!

The reason it’s wrong is functional and can be understood linguistically.

I’ll try to explain…

In plain language, we might say a sentence like: if you have pita bread, I will buy 1. Otherwise, give me 1 of any bread you have.

In code that would look like

if (pita_bread) {
    purchase(pita_bread);
    } else {
          purchase(any_other_bread)
    }

The else-ifs are more specific, if you want to specify other possibilities if your original condition is not met.

1 Like

ok. thank you very much for helping. im gonna go back and review. thank you again

1 Like

Sorry for the briefness of my initial answer. I forget sometimes what it is like being new now that I’ve learned a lot. Looks like I forgot to put my code in the code block also.

I appreciate the answer!