Ted Flethuseo wrote: > I was wondering if a loop of this sort would be > effective in ruby for a large number of elements > > for i in 1..layers[0].count-1 > puts i > end > > Is it equivalent in efficiency to this? > > int i = 1 > while i < layers[0].count-1 > puts i > i+=1 > end > > Don't wonder, benchmark it[1]. My guess is that the former is more efficient because you are only calculating layers[0].count-1 once instead of every iteration, but you never know. Neither one is particularly idiomatic Ruby. -Justin [1] http://ruby-doc.org/stdlib/libdoc/benchmark/rdoc/classes/Benchmark.html