[fpc-pascal] Case statements without constants?

Michael Van Canneyt michael at freepascal.org
Mon Oct 29 11:24:13 CET 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.

Case has never allowed variables.

and it is also not a group of if..else blocks. The compiler uses jump
tables when possible etc when it encounters a case.


More information about the fpc-pascal mailing list