I know that I can use
my_array = [1,2,3,4,5]
my_array.each {|element| puts element}
to do something with each element of an array but what if I need to do several things with each element? It starts complaining when I try to put multiple statements in the block. What I am really looking for is something more like this:
my_array = [1,2,3,4,5]
my_array.each |element| do
#operation one involving the element
#operation two involving the element
...
end
Is there any good way to achieve this effect?