On Dec 10, 2006, at 8:41 PM, Norman Palardy wrote:


On Dec 09, 2006, at 1:55 PM, Lars Jensen wrote:


Consider this oft-repeated pattern:

 dim items() as string = Array(...)
 for each item as string in items()
    ...
 next

Why is "as string" necessary in the "for" statement? I'd rather just say:

 dim items() as string = Array(...)
 for each item in items()
    ...
 next


How about

 dim items() as variant
 .... fill the array somehow ....

 for each item in items()
    ...
 next

What type should "item" be ?

It would be a variant, I think, as in old versions of VisualBasic. Currently, VisualBasic uses a For...Each construct similar to Rb's, requiring dimensioning of the control variable prior to or within the For...Each statement, and most collection types support For...Each (ie., arrays, collections, hashtables).

Best,


Jack




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to