about Array methods

  • Thread starter Kyung won Cheon
  • Start date
K

Kyung won Cheon

l = [1,2,3,4,5]
head = l[0..2]
p head # => [1,2,3]
p l # => [1,2,3,4,5]

# I want '[4,5]'

# Is that method in Array?
 
P

Peña, Botp

From: Matthew Moss [mailto:[email protected]]=20
# > p l # =3D> [1,2,3,4,5]
# >
# > # I want '[4,5]'
# >
# > # Is that method in Array?
#=20
# l =3D l[3..-1]
#=20

also,=20

array.last(2)
 
M

Mathijs

Kyung won Cheon schreef:
l = [1,2,3,4,5]
head = l[0..2]
p head # => [1,2,3]
p l # => [1,2,3,4,5]

# I want '[4,5]'

# Is that method in Array?

p l-head # => [4,5]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,184
Messages
2,570,973
Members
47,530
Latest member
jameswilliam1

Latest Threads

Top