Why is this code wrong?


"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]}


We can iterate over the sub_array...

sub_array.each { |x| puts x }


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