[Gambas-user] Documentation of FOR EACH
Jussi Lahtinen
jussi.lahtinen at ...626...
Mon Oct 26 20:43:15 CET 2009
OK.
Thanks!
Jussi
2009/10/26 Benoît Minisini <gambas at ...1...>:
>> http://gambasdoc.org/help/lang/foreach
>>
>> "The order of the enumeration in not necessarily predictable. See the
>> documentation of each enumerable class for more details on that."
>>
>> I can't find any else information on that topic.
>> What does that mean?
>>
>> Jussi
>>
>
> It means that sometimes the order of elements is predictable, sometimes it is
> not.
>
> If you enumerate an array or a collection, the order is predictable. Arrays
> are enumerated by index, while collections are enumerated by following the
> element creation order.
>
> The following code:
>
> Dim aArray As New String[] = [ "blue", "white", "red" ]
> Dim aCol As New Collection = [ "a": "blue", "b": "white", "c": "red" ]
> Dim sVal As String
>
> For Each sVal in aArray
> Print sVal;;
> Next
> Print
>
> For Each sVal in cCol
> Print sVal;;
> Next
> Print
>
> will print:
>
> blue white red
> blue white red
>
> For other enumerable classes, you must suppose that the order of enumeration
> is random, unless the contrary is explicitely written in the class
> documentation.
>
> Regards,
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> 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