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
An if the array is nil then we can enforce to empty array
if (array || []).each do |x| #... puts "x",x end.empty? puts "empty!" end