foreach

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 13 00:33:51 PDT 2014


On 12/06/14 21:21, Nick Sabalausky wrote:

> - I rarely need to do that. Most of my "N times" loops exist *because* I
> want to use the index.


I use the "n.times" in Ruby for testing quite a lot. When I need to 
create x instances of a class and it doesn't matter what values they 
have. Although I usually use that together with a map.

@foos = 3.times.map{ Foo.new }

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list