Module Checkit { Function GetMode(&a()){ Local max% if len(a())=0 then =(,) link a() to a$() n%=len(a()) dim c%(n%) if type$(a(0))="String" then { For i%=0 to n%-2 For j%=i%+1 to n%-1 if order(a$(i%), a$(j%))=0 then c%(i%)++ Next j% If c%(i%)>max% Then max%=c%(i%) Next i% For i%=0 to n%-1 If c%(i%) = max% Then Data a$(i%) Next i% } Else { For i%=0 to n%-2 For j%=i%+1 to n%-1 if a(i%)==a(j%) then c%(i%)++ Next j% If c%(i%)>max% Then max%=c%(i%) Next i% For i%=0 to n%-1 If c%(i%) = max% Then Data a(i%) Next i% } =Array([]) } Dim m() m()=(2,3,43,234,234,3,324) Print GetMode(&m()) ' 3 234 k=(1,2,1,2,1,2,3) n=GetMode(&k) ' iterate backward i=each(n, -1, 1) While i { Print Array(i), } Print k=("A","B","A","B", "B","C","D","A") ? GetMode(&k) ' A B } Checkit