someList.numbered
Posted: Sat Feb 14, 2009 7:59 am
I've updated Cobra to support "for k, v in ..." for any IEnumerable<of KeyValuePair<of TKey, TValue>>. This specifically impacts the .numbered extension method for lists:
See also: StandardLibraryExtensionMethods
class X
def main is shared
colors = ['red', 'green', 'blue']
for i, color in colors.numbered
print i, color
for i, color in colors.numbered
assert (i==0 and color=='red') _
or (i==1 and color=='green') _
or (i==2 and color=='blue')
See also: StandardLibraryExtensionMethods