From: "Peña, Botp" Date: 2008-08-09T14:09:03+09:00 Subject: Re: Most compact command for associate array 'totalling'? From: John Pritchard-williams [mailto:monojohnny@googlemail.com] # So can somebody explain in English what is going on here ? # This is very very Ruby to me :-) I'm guessing that we are # hanging that block of the 'store' method of 'h' from now on ? # I mean: so when somebody then calls something like: # # h.store(mykey,myvalue) it will invoke the block which will result in: # h[mykey]=myvalue - but only if 'myvalue' is nil ? no. nil is a value and could be value for a hash key. try h[mykey] = nil the block form will invoke the block if the hash key does not exist try h.has_key? mykey # Is this a very specific mechanism to hashes or something # really generic? imho, if you work on hashes, you should know block form of Hash.new. See ruby-doc for examples. kind regards -botp