Friday Finking: Contorted loops

Alan Gauld alan.gauld at yahoo.co.uk
Fri Sep 10 07:26:24 EDT 2021


On 10/09/2021 00:47, Terry Reedy wrote:

> even one loop is guaranteed.)  "do-while" or "repeat-until is even rarer 
> since fractional-loop include this as a special case.

Is there any empirical evidence to support this?
Or is it just a case of using the tools that are available?
In my experience of using Pascal (and much later with Delphi)
that I used repeat loops at least as often as while loops,
possibly more.

But using Python and to a lesser extent C (which has a
rather horrible do/while) construct I use while loops
(often with an if-break) simply because that's what
the language offers.

So is it the case that the "need" for repeat loops is
rare, simply a result of there being no native repeat
loop available? After all we could have done without
a for loop too and just used a while loop for
everything (as was done in Oberon(?) ) Would we
then state that the use of for loops was rare?
But I would hope that any empirical research would
look at the wider function of the loop and its
purpose rather than merely analyzing the syntax
and keywords.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Python-list mailing list