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 233 views
1 answer 239 views
239 views asked Aug 30, 2020 by avibootz
1 answer 193 views
1 answer 195 views
1 answer 201 views
1 answer 201 views
...