use select to get value by condition : select « Hash « Ruby






use select to get value by condition


zip = { 1 => "A", 2 => "B", 3 => "C"}

zip.select { |key,val| key > 2 }

 

Related examples in the same category