// This tests the labeled "next" for multifor which gives a level to jump to. // This program demonstrates bailing out of multifor loops with labeled // next statements. It generates only unique lists of numbers. (This could // be generated efficiently with the array.permute[] method, but the condition // in this program could be modified for different conditions easily.) s = new set upper = 7 n = new array for i=1 to upper n.push[new range[1,upper]] LOOP: multifor a = n { len = length[a] for i=0 to len-1 if s.contains[a@i] // Duplicates found in output? { s.clear[] next LOOP i // Demonstrates labeled next, jump to next level i } else s.put[a@i] s.clear[] println[a] }