Multidimensional each

Posted by c00lryguy on Stack Overflow See other posts from Stack Overflow or by c00lryguy
Published on 2010-05-06T04:27:55Z Indexed on 2010/05/06 4:48 UTC
Read the original article Hit count: 229

Filed under:

How would I do something like below?

[
    'foo'
    ['bar', 'baz'],
    [
        'one',
        ['two', 'three']
    ]
].each { |word| puts word }

# I want this to return:

foo
bar
baz
one
two
three

© Stack Overflow or respective owner

Related posts about ruby