[fpc-pascal] basic question on begin, end;

Bo Berglund bo.berglund at gmail.com
Thu Sep 24 10:03:56 CEST 2020


On Wed, 23 Sep 2020 08:28:20 -0700, Ralf Quint via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:

>Similar like moving code blocks around in 
>Python with a one-off indentation and all the sudden the flow of that 
>code changes, without complaining...

This use of whitespace as block delimiter is why I never could cope
with Python when I was working (now retired).

Begin-end are really big helpers to correctly structure loops etc and
I use them all the time to make things clearer.

Also putting begin right below if, for, while etc makes it much easier
in Lazarus to see what happens in multi-level code when one is
selecting begin or end since they match vertically.
So I never do:

if something then begin
  some multi-line code here
end;

Instead:

if something then
begin
  some multi-line code here
end;

And of course as has already been pointed out the original question's
example code fundamentally changes execution with or without the
begin-end pair!


-- 
Bo Berglund
Developer in Sweden



More information about the fpc-pascal mailing list