[fpc-pascal] Case statements without constants?

Sven Barth pascaldragon at googlemail.com
Mon Oct 29 11:08:26 CET 2018

Ryan Joseph <ryan at thealchemistguild.com> schrieb am Mo., 29. Okt. 2018,

> I tried today to make a case that used variables instead of constants and
> was surprised to get an error. I’m sure this been true since the 80’s but
> why don’t cases allow variables??? I thought a case statement was just a
> group of if..else blocks in succession.

No it's not. At least for ordinal values it's usually implemented as a jump
table or something optimized like that which would not work with variables
as labels.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20181029/d876e336/attachment.html>

More information about the fpc-pascal mailing list