<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">The difference between IF and CASE is, that in the CASE the type of the expression is changed to the type extension. Very handy for message handlers. See below<div><br></div><div>TYPE</div><div> Base = RECORD END</div><div> Ext = RECORD (Base) i: INTEGER END;</div><div> Ext2 = RECORD (Base) c: CHAR END;</div><div><br></div><div>PROCEDURE CaseExample(VAR b: Base);</div><div> BEGIN</div><div> CASE b OF</div><div> Ext: b.i := 0</div><div> | Ext2: b.c := „A“</div><div> END;</div><div> (* this is equivalent *)</div><div> IF b IS Ext THEN b(Ext).i := 0</div><div> ELSIF b is Ext2 THEN b(Ext2).c := „A“</div><div> END</div><div> END CaseExample;</div><div><br></div><div><div><div>Jörg</div><div><br>Am 17.02.2018 um 23:32 schrieb Arthur Yefimov <<a href="mailto:artur.efimov@gmail.com">artur.efimov@gmail.com</a>>:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Andreas wrote:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><div class="gmail_default" style="display:inline">> </div><span style="font-family:arial,sans-serif;font-size:12.8px">One just needs to get the order right: extended types first, base type last (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="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Does it mean that CASE statement for pointer/<span style="color:rgb(34,34,34);font-family:arial,helvetica,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">record</span> types work like an IF statement? Does it sequentially check all options one by one until it hits the right one? In this case, what does "CASE" give in comparison to using "IS" clause, i.e. "IF obj IS MyViewer THEN ... ELSIF obj IS ..."?</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div></div></div>
</div></blockquote><blockquote type="cite"><div><span>--</span><br><span><a href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems</span><br><span><a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a></span><br></div></blockquote></div></div></body></html>