EDIT: the EXCL should be in the IF, of course. PROCEDURE ReverseWord(wd: INTEGER): INTEGER; VAR i: INTEGER; rwd, u: SET; BEGIN u := SYSTEM.VAL(SET, wd); rwd := {}; i := 0; WHLE u # {} DO IF i IN u THEN INCL(rwd, 31-i); EXCL(u, i) END; INC(i) END RETURN SYSTEM.VAL(INTEGER, rwd) END ReverseWord; ---=====--- Александр