Why is this code wrong?


#1




"Oops, try again. It looks like you didn't print out each element of the s array."

That said, this code does print all the elements of the two arrays!


s = [["ham", "swiss"], ["turkey", "cheddar"], ["roast beef", "gruyere"]]

s.each {|sub_array| puts sub_array[0] + "," + sub_array[1]}


#2

We can iterate over the sub_array...

sub_array.each { |x| puts x }

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.