[fpc-pascal] List of chars for case
    Dennis 
    dec12 at avidsoft.com.hk
       
    Mon Jul  2 08:48:54 CEST 2018
    
    
  
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
    
    
More information about the fpc-pascal
mailing list