1.I can\'t find an elegant way to write this code:
if array.empty? # process empty array else array.each do |el| # process el end end
What about?
array.each do |x| #... puts "x",x end.empty? and begin puts "empty!" end