ruby - How can I loop through arrays skipping previously referred elements? -


is there way loop through 2 arrays , have them refer element each time? example:

first_array = ['a', 'b', 'c', 'd'] second_array = ['e', 'f', 'g', 'h']  first_array.each |item| puts item.get(second_array) 

the results like:

a work e b work f c work g     d work h 

i'm trying make when variable first_array passed work second_array, moves next variable in second_array, skipping used variable.

that zip.

first_array.zip(second_array){|e1, e2| ...} 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -