nums = {a: 1, b: 2, c: 3, d: 4, e: 5} nums.each do |key, val| nums.delete key unless val.even?end p nums
Standard input is empty
{:b=>2, :d=>4}
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!