From: Pit Capitain Date: 2008-08-14T04:31:58+09:00 Subject: Re: What's the easiest way to check if param[:x][:y] exists? 2008/8/12 David A. Black : > But if you want to have a hash > that automatically inserts a hash for an unknown key, you can do: > > func = lambda {|h,k| h[k] = Hash.new(&func) } > hash = Hash.new(&func) David, hashes like this don't solve Josh's problem. He wants two conflicting things: 1) param[:x][:y] should be false or nil, so that you can use it as a condition 2) you should be able to nest arbitrarily deep, for example param[:x][:y][:z] If Josh really wanted to do that, he'd have to define FalseClass#[] or NilClass#[], but as you have written he'd better change his data structures. Regards, Pit