Shift a hash : shift « Hash « Ruby






Shift a hash


h = { :a=> 1, :b=>2 }
print h.shift[1] while not h.empty?   # Prints "12"

 

Related examples in the same category