Get all combinations of array elements

Just for fun, I implemented a solution but only for 3 elements. For more elements, I would recommend to use a recursive function and C++, but nothing stops you of just adding as many loops as necessary in this one.

It’s a function that takes an array of 3 elements and outputs an array of strings containing all the combinations. In this case, 27 combinations. However it’s quite easy to change the input and output types. I only use these ones because yes.

Function:

Usage:

Result:

301723-3.jpg