From: wys@... (Clemens Wyss) Date: 2001-04-06T15:10:04+09:00 Subject: [ruby-talk:13527] Re: Newbie Question ts wrote in <200104051449.f35EnUN21222@orsay1.moulon.inra.fr>: > > First you assign the string '10' to h['1'], then you index this string > with '2' and replace the content (if it found) with '10' > << SNIP >> > In you case '2' was not found in '10' and ruby has not modified the > hash, I would have expected that Ruby raised an error here! Smalltalk has the following methods: at: put: which would raise an exception if the key/index does not exist. The "exception handling variant": at: put: ifAbsent: would execute the block if the key/index is not valid. These methods apply for Arrays (String etc.) and Hashes (Dictionary). Clemens