To drive parent's point home a bit, I skimmed both examples above when reading and without looking again I am very certain that the map example does not have any weird iteration semantics (eg "stop filling the first time a zero is encountered"), but I'm not sure that the for loop example is similarly 'normal' -- I'd have to check the condition again more carefully.