DEV Community

Calvin
Calvin

Posted on

Reading Snippets [53 => Ruby] 💎

Iterating over an array in Ruby is one thing. Iterating over a multi-dimensional array in Ruby is another. Ruby presents an elegant way to iterate through an array using array.each {}.

The process of iterating through a two-dimensional array is slightly different:

s.each { |sub_array| sub_array.each { |element| puts element }}

Codecademy Ruby Course

Top comments (0)