session3/challenge/1_blocks.rb
# Write a method, reverse_map, which invokes a block on each of the elements in reverse order,
# and returns an array of their results.
#
# reverse_map(1, 2, 3) { |i| i * 2 }      # => [6, 4, 2]
Write a method, reverse_map, which invokes a block on each of the elements in reverse order,
and returns an array of their results.


Write a method reverse_map which invokes a block on each of the elements in reverse order and returns an array of their results .
def reverse_map(*args)
  output = []
  args.each { |element| output << (yield element if block_given?) }
  output.reverse!
end
def reverse_map ( * args ) output = [ ] args . each { | element | output << ( yield element if block_given? ) } output . reverse! end
Write a method, reverse_map, which invokes a block on each of the elements in reverse order,
and returns an array of their results.
Write a method reverse_map which invokes a block on each of the elements in reverse order and returns an array of their results .
args
<not_specific>