Will Array#each only go through each unique element once even if you
were to throw around the elements in the array or will it just take
whatever element is after the current one?
I tried it myself but it behaves a bit strange.
a = [1, 2, 3, 4, 5, 6, 7]
a.each do |x|
print x
if x == 2
a.reverse!
end
end
It prints 1254327. Somehow the last element was intact and printed a 7
instead of 1.
···
--
Posted via http://www.ruby-forum.com/.