you can get enumerate in your own code in the interim by adding in the code given in ticket:126
ticket:129 is about iterating on a keyValuePair not about iterating on a dict....
iterating on a dict does work in the (fm src tree) version (0.8.0 post release)
Csaba,
did you try it? (modulo getting the syntax for a dict literal right)
- Code: Select all
for bindingInt, bindingWord in { 1_000_000_000 : ' billion', 1_000_000 : ' million', 1000 : ' thousand', 100: ' hundred'}
print bindingInt, bindingWord
# gives
- Code: Select all
> cobc0 csa.cobra
1000000000 billion
1000000 million
1000 thousand
100 hundred
Theres an example in the test cases - multi-arg-forDict.cobra
- Code: Select all
xdict = {0:'z', 1:'w', 3:'x'}
for k,v in xdict
print 'k=',k, 'v=',v
assert k in [0,1,3]
assert v in ['z', 'w', 'x']
The doc/wiki unfortunately needs a lot of updating...