Is it true that we cannot embed a for loop within another for loop? I was trying this simple code - for a reason to be mentioned below- and I've got an error message. What am I doing wrong? Is there a way to embed for loops and to have them work correctly? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ L:=[0,1,2]: for i in L do print(i) for j in L do print(j) end do; end do; print(Typesetting:-ASM, "assembled object is invalid"); # input placeholder Error, unterminated loop ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ What I was trying to do was to generate a list of lists as follows. For a given list, let's say L:= [0,1,2], create the list of all possible pairs [i,j] with i and j in L. That list will be [[0,0],[0,1],[0,2],...]. The naive approach will be to embed a for loop within another for loop. My list is not large and this naive approach should work. Is there a more elegant way to do this? Thanks!!

Please Wait...