Hi,

In message "[ruby-talk:20840] modify hash during iteration"
    on 01/09/04, Tomas Brixi <brixi / unicode.cz> writes:

|I have a question to following piece of code
|-----------------
|h = Hash.new
|#assign some data
|
|h.each do |pair|
|    h[pair[0]] = new_value
|end
|-----------------
|
|is this the right way or are there better ways to do this

It's OK to change the associated value to the existing key.  In case
you add new key during hash iteration, it may or may not appear in the
iteration.  But it shouldn't crash anyway.

							matz.