An else statement is missing a matching if statement. The if statement is followed by a statement or compound statement and subsequently followed by the optional else statement. That is the only context in which the else statement can appear.
A compound statement is explicitly surrounded with braces. The compiler ignores tabbing conventions, which help improve the readability of the code.
To correct this error
-
Enclose the code that follows the if statement in braces.
-
Add an if statement before the else statement.