What about enumerate: http://docs.julialang.org/en/latest/stdlib/base/?highlight=enumerate#Base.enumerate?
On Thu, May 15, 2014 at 2:48 PM, Yakir Gagnon <12.ya...@gmail.com> wrote: > I love the > for file in files > ... do something with file ... > end > > syntax. But sometimes it's really useful to be able to have an iterator > accessible in the for loop, like: > > for file in files > ... do something with file ... > ... and with i that equals find(file == files) ... > end > > > Is there something built in like that, other than the usual way of: > > for i = 1:length(files) > ... do something with files(i) ... > ... and with i ... > end > > ? >