nums = {a: 1, b: 2, c: 3, d: 4, e: 5} p nums.select { |_, val| val.even? }
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!