How do I iterate the elements of an array in Ruby and in each step I can do something with the array containing all elements, except the one that is iterated in the moment?
For instance for [4,2,8] I iterate the elements and then I can do something with
[2,8][4,8][4,2]
It’s not really directly possible(unless you do not need the missing element). But you can program it yourself:Option 1 – just do it:
Option 2 – integrate with Array:
Output from either one: