[fpc-devel] case is

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Mar 23 16:13:21 CET 2022


On Wed, 23 Mar 2022 22:00:05 +0700
Hairy Pixels via fpc-devel <fpc-devel at lists.freepascal.org> wrote:

> Lol I just implemented this and made a merge request but I haven’t
> heard back from anyone yet so it’s just sitting there….
> 
> I basically just copied the structure used for “case of string” in
> that it makes if a big if-else statement.

Did you use multiple "is" or did you check for sorted and use one loop?

 
> https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/147

"Rebase failed"

Mattias


> 
> > On Mar 23, 2022, at 7:44 PM, Mattias Gaertner via fpc-devel
> > <fpc-devel at lists.freepascal.org> wrote:
> > 
> > Basically for Pascal it is a case block using the "is" operator.
> > Pseudo code:
> > 
> > procedure Fly(o: TObject);
> > begin
> > case o is
> > TButton: TButton(o).foo;
> > TControl: TControl(o).bar;
> > TComponent: TComponent(o).meh;
> > nil: Msg;
> > else Run;
> > end;
> > end;  
> 
> Regards,
> 	Ryan Joseph
> 



More information about the fpc-devel mailing list