Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+15 votes

I am having a problem. It is keep showing "else without if" and I dont know how to fix it. Can anyone help me please? Thank you.

asked in CSC211_Winter2018 by (1 point)

You're probably missing } before else.

2 Answers

+14 votes

You're probably missing } before else.

answered by (1 point)
+13 votes

This means that you have an if / else statement that does not have an if somewhere near the top of the code. You put down an else statement that would activate if an if condition is not met, but you don't have that specific if in particular.

Revise your code. Perhaps you have an if statement with a semicolon at the end instead of a curly bracket? That's one of the most common errors when it comes to if / else statements.

answered by (1 point)