The "loop and a half"

Frank Millman frank at chagford.com
Wed Oct 4 07:22:22 EDT 2017


"Stefan Ram"  wrote in message 
news:VBA-loops-20171004114215 at ram.dialup.fu-berlin.de...
>
> Robin Becker <robin at reportlab.com> writes:
> >Given the prevalence of the loop and a half idea in python I wonder why 
> >we don't
> >have a "do" or "loop" statement to start loops without a test.
>
>   VBA has quite an orthogonal way to build loop control:
>
>   pre-checked positive:
>
> Do While ...
>     ...
> Loop
>
>   post-checked positive:
>
> Do
>     ...
> Loop While ...
>
>   pre-checked negative:
>
> Do Until ...
>     ...
> Loop
>
>   post-checked negative
>
> Do
>     ...
> Loop Until ...
>
>   "endless":
>
> Do
>     ...
> Loop

There is a language called Pick Basic (which most of you have never heard 
of) which has a single syntax covering all possibilities -

    LOOP
        {optional statements}
    WHILE {condition} or UNTIL {condition} DO
        {optional statements}
    REPEAT

The DO and the REPEAT are necessary because it does not use indentation or 
braces to terminate blocks, it uses keywords.

Frank Millman






More information about the Python-list mailing list