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 229 views
1 answer 236 views
236 views asked Aug 30, 2020 by avibootz
1 answer 189 views
1 answer 191 views
1 answer 198 views
1 answer 196 views
...