Re: [fpc-pascal] List of chars for case
> On Jul 2, 2018, at 10:55 PM, leledumbo via fpc-pascal > wrote: > > Only through macro ATM Yeah I cheated and used a macro. ...and that’s why we should allow for macros as a fail safe in times of distress... Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] List of chars for case
> So it can’t be done? Only through macro ATM, I believe. Note that case statement body does NOT expect a set (it expects values, list of values and/or range of values), despite the very similar look (missing enclosing angle brackets only), hence the inability to do what you want. -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] List of chars for case
> On Jul 2, 2018, at 2:07 AM, Mattias Gaertner > wrote: > > That would be useful. So it can’t be done? Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] List of chars for case
On Sun, 1 Jul 2018 16:51:08 -0600 Ryan Joseph wrote: > Is there a way to make a constant for a list of chars which I can use in a > case statement? I’ve got a bunch of code duplication happening I’d like to > clean up. > > const > TChars = ('[', ']', '(', ')', '{', '}', '=', ‘:’); > > > case c of > TChars: That would be useful. Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] List of chars for case
Ryan Joseph wrote: Is there a way to make a constant for a list of chars which I can use in a case statement? I’ve got a bunch of code duplication happening I’d like to clean up. const TChars = ('[', ']', '(', ')', '{', '}', '=', ‘:’); case c of TChars: ... Regards, Ryan Joseph case c of '[', ']', '(', ')', '{', '}', '=', ':' : result := true; end; Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] List of chars for case
On Sun, Jul 1, 2018 at 5:51 PM, Ryan Joseph wrote: > Is there a way to make a constant for a list of chars which I can use in a > case statement? I’ve got a bunch of code duplication happening I’d like to > clean up. > > const > TChars = ('[', ']', '(', ')', '{', '}', '=', ‘:’); > > > case c of > TChars: > ... > I suspect you may need to use sets and the "in" operator. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] List of chars for case
Is there a way to make a constant for a list of chars which I can use in a case statement? I’ve got a bunch of code duplication happening I’d like to clean up. const TChars = ('[', ']', '(', ')', '{', '}', '=', ‘:’); case c of TChars: ... Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal