From: ara.t.howard@... Date: 2006-02-23T11:51:23+09:00 Subject: Re: setting nil to zero On Thu, 23 Feb 2006, [iso-8859-1] Pe�a, Botp wrote: > Hi, > > is there a setting to set nil to zero? something like $NIL=0, then set it back again to $NIL=nil... > > reason is i have quite a number of codes like ff > > s.each do |w| > f[w] = 0 unless f[w] #i want to kill this lne since it does not jive with my pseudocode > f[w] += 1 > end > > thanks and kind regards -botp why not f = Hash::new{|h,k| h[k] = 0} s.each{|w| f[w] += 1} ?? -a -- judge your success by what you had to give up in order to get it. - h.h. the 14th dali lama