Hi, I have a hard time figuring out how arrays work. Here is my problem:
~voice=[1,0,0,1,1]
(~of = 6.collect{|i|~voice})
results in this:
[ [ 1, 0, 0, 1, 1 ], [ 1, 0, 0, 1, 1 ], [ 1, 0, 0, 1, 1 ], [ 1, 0, 0, 1, 1 ], [ 1, 0, 0, 1, 1 ], [ 1, 0, 0, 1, 1 ] ]
How can I add several times 0
to the beginning of each array? E.g. two times 0
to the beginning of the first array, five times 0
to the beginning of the second array, three times 0
to the beginning of the third array, so I get:
[ [ 0, 0, 1, 0, 0, 1, 1 ], [ 0, 0, 0, 0, 0, 1, 0, 0, 1, 1 ], [ 0, 0, 0, 1, 0, 0, 1, 1 ], ...
Thank you in advance!