Use negative array indices in Ruby.

分類:IT技術 時間:2016-10-14
# Negative indices count from the end of the array back to the beginning of the array. 

array = ['Hello', 'there', 'AAA', 1, 2, 3]
puts array[-1]            #prints 3


Tags: beginning count

文章來源:


ads
ads

相關文章
ads

相關文章

ad