[Gambas-user] Best way to enumerate multiple arrays or collections?

Jussi Lahtinen jussi.lahtinen at ...626...
Fri Aug 26 19:39:31 CEST 2016


I'll consider this as the "some other preferred way". Thanks!


Jussi

On Fri, Aug 26, 2016 at 7:16 PM, Benoît Minisini <
gambas at ...1...> wrote:

> Le 25/08/2016 à 20:00, Jussi Lahtinen a écrit :
> > Sometimes I have code where I have multiple arrays or collections, which
> I
> > would enumerate at once.
> >
> > Now I have to do it this way:
> >
> > For Each hObject In hCollection1
> >   DoSomething ...
> > Next
> >
> > For Each hObject In hCollection2
> >   DoSomething ...
> > Next
> >
> >
> > And I would like to do it this way:
> >
> > For Each hObject In hCollection1, hCollection2
> >   DoSomething ...
> > Next
> >
> >
> > Is this possible for future release of Gambas? Or is there some other
> > preferred way?
> > I guess with arrays you can use "insert" to combine the arrays in
> temporary
> > array, but not with collections.
> >
> >
> >
> > Jussi
>
> I don't think I will make the Gambas syntax more complex just to save
> three lines of codes...
>
> Just write:
>
> For Each hCollection In [hCollection1, hCollection2]
>    For Each hObject In hCollection
>      DoSomething...
>    Next
> Next
>
> Regards,
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------
> ------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list