<div style='font-family:arial; font-size:13px;'><div>August, thanks for that. Are you by any chance the author of OBNC? Not that I'm an expert - far from it, but it's a very nice compiler and easy to use. <br></div><div>I never learned OOP with Turbo Pascal and have been avoiding it for a long time because the terminology put me off - classes, methods, polymorphism, inheritance etc. One of the things which attracted me to Oberon is the way OOP is handled; it's just an extension of the record concept, so I'm looking forward to learning it at last. Good to know you experts are on hand to help me out if I get stuck!</div><div><br></div><div>Thanks again to you and Jorg for the words of wisdom. <br></div><div>Joe<br></div><br><div>January 24, 2022 7:29:53 PM CET August Karlstrom <fusionfile@gmail.com> wrote:<blockquote type="cite" cite="<48d1882c-378d-5938-ce56-192335193b7f@gmail.com>"><pre style="font-size:13px;">As mentioned by Jörg, Oberon-07 is a pure structured language in the <br>sense that each (ASSERT free) statement sequence is either fully <br>executed or not executed. With CASE statements you can often limit the <br>range of values to inspect before the CASE statement is executed. Here <br>is one way to do it:<br><br>MODULE case;<br><br>   IMPORT In, Out;<br><br>     VAR<br>           countVowels: INTEGER;<br>         ch, capCh: CHAR;<br><br>BEGIN<br>     In.Open;<br>      countVowels := 0;<br>     In.Char(ch);<br>  WHILE In.Done DO<br>              IF (ch >= "a") & (ch <= "z") THEN<br>                       capCh := CHR(ORD("A") + ORD(ch) - ORD("a"))<br>               ELSE<br>                  capCh := ch<br>           END;<br>          IF (capCh >= "A") & (capCh <= "U") THEN<br>                 CASE capCh OF<br>                         "A", "E","I","O","U":<br>                                       INC(countVowels) |<br>                            "B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", <br>"R", "S", "T":<br>                                     (*do nothing*)<br>                        END<br>           END;<br>          In.Char(ch)<br>   END;<br>  Out.Int(countVowels, 0);<br>      Out.String(" vowels read.");<br>        Out.Ln<br>END case.<br><br>With the WHILE loop we can see instantly that it will continue until <br>there are no more characters to read. Compare this to the LOOP in which <br>the exit condition (or possibly exit conditions) is buried in the <br>contained statement sequence.<br><br><br>-- August<br><br><br>On 2022-01-24 15:14, Joe Turner wrote:<br>> I'm working through the book "Into the Realm of Oberon" which is written <br>> for Oberon-2. I can't figure out how to translate the following program <br>> into Oberon-07 (I'm using the OBNC compiler):<br>> <br>> MODULE case;<br>> IMPORT In,Out;<br>> <br>> VAR countVowels: INTEGER; ch: CHAR;<br>> <br>> BEGIN<br>>    In.Open;<br>>    countVowels:=0;<br>>    LOOP<br>>      In.Char(ch);<br>>      IF ~In.Done THEN EXIT END;<br>>      CASE ch OF<br>>        "a", "e", "i", "o", "u",<br>>        "A", "E","I","O","U": INC(countVowels)<br>>      ELSE<br>>      END;<br>>    END;<br>>    Out.Int(countVowels,0);<br>>    Out.String(" vowels read.");Out.Ln;<br>> END case.<br>> <br>> Oberon-07 doesn't allow LOOP, EXIT, or ELSE in CASE.<br>> Thanks in advance for any help.<br>> -- Sent with <a href="https://mailfence.com" target="_blank">https://mailfence.com</a> Secure and private email<br>> <br>> --<br>> <a href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br>> <a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br><br>--<br>Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems<br><a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br></pre></blockquote></div></div>

-- 
Sent with https://mailfence.com  
Secure and private email