Mega Code Archive

 
Categories / Ruby / Hash
 

Shift a hash

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