On Mon, Oct 29, 2018 at 11:20 AM Michael Van Canneyt <mich...@freepascal.org> wrote: > > > 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. >
I think it is important to differentiate between a language feature and its common implementation. Perhaps case statements with variables make sense? Of course, that doesn't mean anyone is going to add them. I suggest the OP look up pattern matching. Scala may be more readable than Haskell, and there is also OCaml. Cheers, R0b0t1 _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal