Could a multidimensional array be defined with a single %w directive?
For example:
the_array = %w(one two three{some separator}four five{some separator}six seven eight nine)
I need this to build an array with variable amount of items in a row:
the_array = [
['one', 'two', 'three'],
['four', 'five'],
['six', 'seven', 'eight', 'nine']
]
You can do the inverse, use the short-hand word array notation in a standard array brackets.
the_array = [%w(one two three), %w(four five), %w(six seven eight nine)]
The goal of the short-hand word notation is to save all the punctuation in terms of commas and quotation marks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With