For example, I have an array
["red", "green", "blue", "purple"]
There can be any amount of entries in this array. Using this array I want to create a list of possible permutations but never duplicating an item in the array (no repetition)
For example, the above array will result in
red,green,blue,purple
red,green,purple,blue
red,blue,green,purple
red,blue,purple,green
red,purple,blue,green
red,purple,green,blue
green,red,blue,purple
green,red,purple,blue
green,blue,red,purple
green,blue,purple,red
green,purple,blue,red
green,purple,red,blue
blue,red,green,purple
blue,red,purple,green
blue,green,red,purple
blue,green,purple,red
blue,purple,green,red
blue,purple,red,green
purple,red,green,blue
purple,red,purple,blue
purple,green,red,blue
purple,green,blue,red
purple,blue,green,red
purple,blue,red,green
I am new to recursion and I havent quite gripped how to accomplish this with it,
EDIT The answer originally mentioned "combinations", but the technical term for what the OP is looking for is "permutation"; see the OP's comment below, and learn more about combination vs permutation vs variation, here (at least one difference: in permutations, order matters, in combinations, order does not)