How to get the first array element in Ruby

1 Answer

0 votes
arr = ["ruby", "c++", "go", "php", "java"]

puts arr.first
puts arr[0]



# run:

# ruby
# ruby

 



answered Aug 30, 2020 by avibootz

Related questions

1 answer 225 views
1 answer 234 views
234 views asked Aug 30, 2020 by avibootz
1 answer 185 views
1 answer 190 views
1 answer 192 views
1 answer 193 views
...