Array#first and Array#last parameters
Did you know you can pass a number parameter to Array#first and Array#last?
x = [1,2,3,4,5,6,7,8,9,10] x.first 5 => [1,2,3,4,5] x.last 2 => [9,10]This tip was submitted by Alfred Nagy.
-
bobbycontrib liked this
-
alienationsu liked this
-
rimplehorsew liked this
-
messel liked this
-
legsnnylonscrazycelebs liked this
-
biliouserupt liked this
-
samshull liked this
-
retromoustache liked this
-
rubyloveinfo reblogged this from rubyquicktips
-
kimooz reblogged this from rubyquicktips
-
rubyflare liked this
-
lero liked this
-
smurfeater reblogged this from rubyquicktips
-
davidaskew liked this
-
ecleel liked this
-
diablo-urban-o liked this
-
aufwind liked this
-
edham-arief liked this
-
rubyquicktips posted this