[Oberon] LOOP conversion

August Karlstrom fusionfile at gmail.com
Mon Jan 4 13:22:12 CET 2021


On 2021-01-04 11:19, Chris Burrows wrote:
> Here's a trickier example for anybody who is up for a challenge. It was
> found in ETH Oberon - TextFrames.Menu:
> 
>       IF SmallDisplay & (Display.Width < 1024) THEN (*adjust commands*)
>         mb := 0; me := 0; s := 0; d := 0;
>         LOOP
>           (*position to beginning of word*)
>           LOOP
>             IF s >= LEN(commands) THEN EXIT END;
>             ch := commands[s]; INC(s);
>             IF ch = 0X THEN EXIT END;
>             commands[d] := ch; INC(d);
>             IF ("A" <= CAP(ch)) & (CAP(ch) <= "Z") THEN EXIT END
>           END;[...]

I wholeheartedly agree with Jörg that this provides an excellent example 
of why LOOP and EXIT should be abandoned. In my opinion the above logic, 
although efficient, is not much better than using GOTO. There is too 
much to keep in your head at once.


-- August


More information about the Oberon mailing list