procedure Recur(iLevel:integer); var i:integer; begin if iLevel=iLevelCount then Process(X) else for i:=0 to Ai[iLevel].Count-1 do begin X[iLevel]:=Ai[iLevel][i]; Recur(iLevel+1) end; end; Recur(0);
import itertools
sets = ( ('A1', 'A2', 'A3'), ('B1', 'B2', 'B3'), ('C1', 'C2', 'C3') )
combinations = itertools.product(*sets)