function DoSomething: boolean;
begin
if FDoSomethingElse then
begin
DoSomethingElse;
end
end;
I believe the reason why the compiler does not complain about this, is because the semi-colon in Delphi is a statement separator and not a terminator. If I modify this function for example:
function DoSomething: boolean;
begin
if FDoSomethingElse then
begin
DoSomethingElse;
end;
DoOtherStuff
end;
I obviously need to now add in the semi-colon, but I do not need to add in the semi-colon after 'DoOtherStuff'. I currently cannot see any benefit of leaving the semi-colon out. I would not normally code this way and always add in the semi-colon for 2 reasons:
- Adding the semi-colon makes the code more consistent.
- It means later on when the code is modified the semi-colon does not have to be added.