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

Markus Greim info at schleibinger.com
Thu Sep 24 10:11:41 CEST 2020


Bo,


"Programs must not be regarded as code for computers, but as literature for humans"


Niklaus Wirth, the inventor of PASCAL.
Last sentence on the last slide of his presentation. 
given at a conference to honor of his 80th birthday at the ETH Zürich in 2014.


(i had the honor to participate)

Kind Regards


Markus

--- original message ---
On September 24, 2020, 10:04 AM GMT+2 fpc-pascal at lists.freepascal.org wrote:

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


> _______________________________________________

> fpc-pascal maillist - fpc-pascal at lists.freepascal.org

> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
--- end of original message ---
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200924/eeb4928f/attachment.htm>


More information about the fpc-pascal mailing list