Hey! I'm available for hire (and I appreciate tips)  



In Ruby it is safe to add an element to the end of an array during iteration.

a = [0,1,2]
a.each do |b|
puts b
if 1 == (b % 2)
a << a.last + 1
end
end
Ranges as are not arrays.
a = (0..2)

By AJ ONeal

Was this useful to you? Share it!

Also, you can give me a tip or hire me.


Published

2009-12-25

Categories


Tags