--Those that manage multiple pieces of information in order --One variable can have multiple values --Multiple values can be entered in the array
input
names = ["Tanaka","Yamada","Sato"]
puts names
output
Tanaka
Yamada
Sato
Add a value to the end of the array.
input
names << "Suzuki"
puts names
output
Tanaka
Yamada
Sato
Suzuki
Specify and get the subscript. input
name = names[0]
puts name
name = names[2]
puts name
output
Tanaka
Sato
input
puts name[1]
names[1] = "Sasaki"
puts name[1]
output
Yamada
Sasaki
Recommended Posts