From: Pit Capitain Date: 2007-02-23T23:53:14+09:00 Subject: Re: concatenating strings with nil values tchick schrieb: > On 23 Feb., 15:19, Harry wrote: >> Is this what you are looking for? >> >> http://www.rubycentral.com/book/ref_c_hash.html#Hash.new > > Ahem, no. Are you sure? See below... > What I'm actually trying is this: I have an array of hashes, > and I like to make strings out of them. Some of the hashes > do not have values for some keys, so when putting together > the string, I get the error message, but I just want to add > "nil" or something else for this case. words = Hash.new "nil" # I suppose this is what Harry thought of words[0]="one" allWords = "all words:" allWords << words[0] allWords << words[1] p allWords # => "all words:onenil" Regards, Pit