Append array indexes in ruby?
Posted: Wed Sep 28, 2016 3:01 pm
Hi,
Is there any way to append array indexes in ruby?
My arrays:
array 1:
red
green
white
array 2:
tomato
frog
snow
I would like to get at the output :
red tomato
green frog
white snow
I guess the comma between the indexes in the final result should be also defined in the ruby code, so would be nice if we could add a 3th input in to this ruby code which would define the comma.
For instance, if the string comma input would be "@", the final result would be then:
red@tomato
green@frog
white@snow
People, it would be even nicer if you post your answer as a code as well. Take into account that most of us are not reasonable coders
Thanks!
Is there any way to append array indexes in ruby?
My arrays:
array 1:
red
green
white
array 2:
tomato
frog
snow
I would like to get at the output :
red tomato
green frog
white snow
I guess the comma between the indexes in the final result should be also defined in the ruby code, so would be nice if we could add a 3th input in to this ruby code which would define the comma.
For instance, if the string comma input would be "@", the final result would be then:
red@tomato
green@frog
white@snow
People, it would be even nicer if you post your answer as a code as well. Take into account that most of us are not reasonable coders
Thanks!