Answers for "ruby nth element of array"

0

ruby nth element of array

# Ruby program to demonstrate the  
# accessing the elements of the array 
    
# creating string using [] 
str = ["GFG", "G4G", "Sudo", "Geeks"] 
    
# accessing array elements 
# using index 
puts str[1] 
    
# using the negative index 
puts str[-1]
Posted by: Guest on March-11-2022

Code answers related to "ruby nth element of array"

Browse Popular Code Answers by Language