<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 02.07.2017 19:29, Martok wrote:<br>
</div>
<blockquote type="cite"
cite="mid:864e3463-2017-1e2c-92ce-87c51818ab73@martoks-place.de">
<pre wrap=""> - Case statements execute <b class="moz-txt-star"><span class="moz-txt-tag">*</span>precisely one<span class="moz-txt-tag">*</span></b> of their branches: the statements of
the matching case label, or the else block otherwise</pre>
</blockquote>
<p>To support your argument, the current Delphi documentation says
the same:</p>
<p><a class="moz-txt-link-freetext" href="http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Declarations_and_Statements">http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Declarations_and_Statements</a></p>
<p><i>Whichever caseList has a value equal to that of
selectorExpression determines the statement to be used. If none
of the caseLists has the same value as selectorExpression, then
the statements in the else clause (if there is one) are
executed.</i></p>
<p>According to Delphi documentation, invalid values should point to
the else clause.</p>
<p>Furthermore, it is OK to use invalid values in caseList as well:
<br>
</p>
<p><tt>program Project1;</tt><tt><br>
</tt><tt><br>
</tt><tt>{$APPTYPE CONSOLE}</tt><tt><br>
</tt><tt><br>
</tt><tt>type</tt><tt><br>
</tt><tt> TMyEnum = (one, two);</tt><tt><br>
</tt><tt><br>
</tt><tt>{$R+}</tt><tt><br>
</tt><tt>var</tt><tt><br>
</tt><tt> E: TMyEnum;</tt><tt><br>
</tt><tt>begin</tt><tt><br>
</tt><tt> E := TMyEnum(-1);</tt><tt><br>
</tt><tt> case E of</tt><tt><br>
</tt><tt> one, two: Writeln('valid');</tt><tt><br>
</tt><tt> TMyEnum(-1): Writeln('minus one');</tt><tt><br>
</tt><tt> else</tt><tt><br>
</tt><tt> Writeln('invalid');</tt><tt><br>
</tt><tt> end;</tt><tt><br>
</tt><tt>end.</tt><tt><br>
</tt><br>
</p>
<p>The program above writes 'minus one' in Delphi.<br>
</p>
<p>Ondrej<br>
</p>
</body>
</html>