slice with one parameters : slice « Array « Ruby






slice with one parameters


year = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009]
p year.slice(1) # => 2001

 








Related examples in the same category

1.slice with two parameters
2.slcie with range parameter
3.slice with exclusive range parameter