Ruby program to print an array

This example we are print an array values

arr= Array["Java","Kotlin","Flutter","Reactnative"]

 

#printing single element

puts arr[0]

 

#printing all the elements in a single row

print arr

 

#printing one by one using for loop

for i in arr

  puts i

end

 

#printing one by one without loop

puts arr

 

Output

Java
["Java", "Kotlin", "Flutter", "Reactnative"]
Java
Kotlin
Flutter
Reactnative
Java
Kotlin
Flutter
Reactnative

 


Flutter Questions

Android Questions

Python Questions

Java Questions