Forums

someList.numbered

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

someList.numbered

Postby Charles » 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:
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
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: someList.numbered

Postby jonathandavid » Sat Feb 14, 2009 10:04 am

Thanks, this is a great addition.
jonathandavid
 
Posts: 159

Re: someList.numbered

Postby Charles » Tue Feb 17, 2009 4:12 pm

You're welcome.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 4 guests