<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">  > Hi everybody,
  >
  > recently I noticed that there is no ELSE clause in the CASE statement of
  > the latest Oberon language version.
  > Has this been removed intentionally or accidentally? Or is there something
  > new instead of it?</span></font><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">  ></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">  > ...<br class=""></span></font><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">  ></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">  > - Josef</span></font></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">Josef,</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">1. The numeric case, i.e. where the type T of the case expression (case variable) is of type INTEGER or CHAR, is not actually implemented in Oberon 2013. As a consequence, one now needs to use e.g. an IF statement instead.</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">2. Only the case where t</span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">he type T of the case expression (case variable) is a RECORD or POINTER type is implemented in Oberon 2013. In this case, the case labels must be extensions of T. This is typically used in installed handler procedures in the Oberon viewer system - which now seems to have become the intended main use of CASE.</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Now one can why there is no ELSE clause: I</span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">f the type T of the case expression is a RECORD or POINTER type, the ELSE can always be simulated by simply specifying the *base* type of T as the *last* element in the case list.</span></font></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">.. as in MenuViewers.Handle:</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">  CASE</span><span style="white-space: pre-wrap; font-family: monospace;" class=""> M </span><span style="white-space: pre-wrap; font-family: monospace;" class="">OF</span></div><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">    Oberon.InputMsg: ... </span><span style="white-space: pre-wrap;" class="">|</span></font><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">    Oberon.ControlMsg:</span> ... <span style="white-space: pre-wrap;" class="">|</span><br class=""><span style="white-space: pre-wrap;" class="">    Oberon.CopyMsg:</span> ... <span style="white-space: pre-wrap;" class="">|</span><br class=""><span style="white-space: pre-wrap;" class="">    Display.FrameMsg: ..   (*this is in fact the ELSE clause*)</span><br class=""><span style="white-space: pre-wrap;" class="">  END</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">One just needs to get the order right: extended types first, base type last </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">(if one placed the base type at the beginning of the list, it would always evaluate to TRUE even if M were an extension of T)</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Andreas<br class=""></span></font><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div></div></div></body></html>