[Oberon] Bit-fiddling: SETs and type casts in Oberon-07

Chris Burrows cfbsoftware at gmail.com
Sun Aug 7 03:44:45 CEST 2022


On Sun, Aug 7, 2022 at 9:41 AM Chris Burrows <cfbsoftware at gmail.com> wrote:

>
> otherwise my preference would be:
>
>   PROCEDURE CAP(ch: CHAR): CHAR;
>    (*
>     Capitalizes ASCII lower-case letters while leaving all other
> characters unchanged.
>    *)
>  VAR
>     cap: CHAR;
>   BEGIN
>     IF (ch >= "a") & (ch <= "z") THEN cap := CHR(ORD(ch) - 32) END;
>     RETURN cap
>   END CAP;
>
>
> Oops!

 IF (ch >= "a") & (ch <= "z") THEN cap := CHR(ORD(ch) - 32) ELSE cap := ch
END;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20220807/c0447d0f/attachment.html>


More information about the Oberon mailing list