function TPrimeThrd.IsPrime: boolean; var iter: integer; begin result := true; if FTestNumber < 0 then begin result := false; exit; end; if FTestNumber <= 2 then exit; iter := 2; while (iter < FTestNumber) and (not terminated) do begin if (FTestNumber mod iter) = 0 then begin result := false; {exit;} end; Inc(iter); end; end;