From: David Kastrup Date: 2006-11-25T04:52:57+09:00 Subject: Re: Shortening this expression ? Friedrich Dominicus writes: > KDr2 writes: > >> Friedrich Dominicus >> writes: >> >>> Zouplaz writes: >>> >>>> Hello, I don't like the verbosity of these two lines >>>> >>>> years = Array.new >>>> 2003.step(Time.now.year) { |a| years << a } >>>> >>> years = (2003...Time.now.year+1).entries >> maybe "a..b" is better than a...b+1 :P > > depends > years = Array.new; 2003.step(Time.now.year) { |a| years << a } > irb(main):002:0> years > [2003, 2004, 2005, 2006] > irb(main):003:0> years = (2003...Time.now.year+1).entries > [2003, 2004, 2005, 2006] > irb(main):004:0> > > > I think +1 is better, YMMV You realize that "a..b" is the same as "a...b+1"? -- David Kastrup, Kriemhildstr. 15, 44793 Bochum