Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby each with index

colors = ['red', 'green', 'blue']
colors.each_with_index do |item, index|
	p "#{index}:#{item}" 
end

"0:red"
"1:green"
"2:blue"
 
PREVIOUS NEXT
Tagged: #ruby #index
ADD COMMENT
Topic
Name
9+7 =