Ruby Array Ranges -
(2011..1995).to_a
returns array
(time.now.year.to_i..1995).to_a
doesn't. why?
try
> 2011.downto(1995).to_a => [2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995]
(2011..1995).to_a
returns array
(time.now.year.to_i..1995).to_a
doesn't. why?
try
> 2011.downto(1995).to_a => [2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000, 1999, 1998, 1997, 1996, 1995]
Comments
Post a Comment