What does it mean when you get the error; Illegal use of the resevered word; else.

   if(); 
    {
    alert();
    } else {
    alert();
    };

Recommended Answers

Why is there a semicolon at the end of line 1?

Jump to Post

All 3 Replies

Why is there a semicolon at the end of line 1?

The semi-colon on line 1 is not the correct sytax for an if/else, so when the compiler gets to line 4 it does not see it as a valid else

thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.