357mag 2 Posted June 2, 2023 I thought in Delphi there was end; with a semicolon And end. with a period But I have seen a third end That one has nothing after the keyword What's going on? Share this post Link to post
Dave Nottage 557 Posted June 2, 2023 (edited) 10 minutes ago, 357mag said: But I have seen a third end That one has nothing after the keyword The semicolon is optional after an end in some circumstances. Please see this. I know it's not after an "end" but the principle is still the same. Edited June 2, 2023 by Dave Nottage Share this post Link to post
Virgo 18 Posted June 2, 2023 49 minutes ago, Dave Nottage said: The semicolon is optional after an end in some circumstances. Semicolon is also forbidden before else... Share this post Link to post
David Heffernan 2345 Posted June 2, 2023 (edited) Semicolon is the statement separator, and so is only needed if the next code is a statement It's also only by convention that you put the semicolon right next to the end. You could equally write: begin // foo end ; Same is true for the end of a unit. You can write it like this: end . If you omit the period at the end of a unit the compiler error says Quote [dcc32 Error]: E2029 '.' expected but end of file found So, it's talking about the period which it considers a separate thing. So, in conclusion, there's only one end keyword. And semicolon is the statement separator, unrelated to end. And the period marks the end of a unit. Again unrelated to the end keyword. Edited June 2, 2023 by David Heffernan Share this post Link to post