Forum > Beginners

If-then-else inside try-finally; "EXCEPT" expected but "ELSE" found... ?

<< < (2/3) > >>

It's good to know that even Pascal can suffer from the same mis-design as C.


--- Quote from: TinSoldier on December 24, 2014, 04:02:19 pm ---It's good to know that even Pascal can suffer from the same mis-design as C.

--- End quote ---
Both are born in the same era, and can't escape some of its original sins easily.

Guys, don't get me wrong; I love Pascal, it's the only language I've really been able to grasp in a meaningful capacity.  I do understand the why of this particular syntax ("a semicolon is a separator not a terminator") but at times like this, I'd like the compiler to tell me what's really wrong, instead of what it expects to be wrong.  I'd like it to warn me that I've put a semicolon in an If..Then instead of flipping out because "End" seems to be misplaced.  Maybe that's what the compiler sees as wrong, and maybe that's correct, but it's certainly not helpful.

Back to taking over the world...

Surely it is some kind of generic message, which appears for a huge number of cases, maybe the message could be more specific, but it do is helpful if you understand what it means.

You do need to learn the FreePascal modus operandi in order to use it well.

The computer doesn't know what you mean, only what you actually say. Once it sees the semicolon at the end of the statement after if ... then ..., then it thinks that the if statement is complete and forgets it completely. The next token it expects is either another statement or because it's within the try statement an except statement.

I'm not a Pascal expert (I'm here to learn too), but I've seen this bug reported often in brace languages like C. This bug probably would have burned me too!


[0] Message Index

[#] Next page

[*] Previous page

Go to full version