Ruby Scripting - Array

A literal array is created by putting square
brackets around a comma-separated list of elements

eg:

# ["zero" , "un" , "dos" , "tre" ]
a = ['zero' , 'un' , 'dos' , 'tre' ]


# 4
a.length

# 4
a.size

# "zero"
a[0]


# ["un" , "dos" , "tre" ]
a[1..3]

 

你可能感兴趣的:(script)