Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby array loop

array = ["A", "B", "C"]
array.each_with_index {|val, index| puts "#{val} => #{index}" }

# Output:

A => 0
B => 1
C => 2
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ruby #array #loop
ADD COMMENT
Topic
Name
3+6 =