I have data for x and y, but I need to create a loop to get : for every element of x will be combined with all the elements of y . For example
If I have x={1,2,3,4,5} , y={1,2,3,4,5} and I need this result for {x,y} : {{1,1},{1,2},{1,3},{1,4},{1,5},{2,1},{2,2},{2,3},
..{5,5}} , how can I create this loop? Below is my loop, but it doesn't give me any result!!
x = {1, 2, 3, 4, 5};
y = {1, 2, 3, 4, 5};
result = {}
For[i = 1, i <= Length[x], i++,
For[j = 1, j <= Length[y], j++,
AppendTo[result, {x[[i]], y[[j]], i}]]]
Thanks!!