you can exit a while loop with break.
How to exit from an if .
Is there a kind of GOTO in Delphi ?
procedure ...
begin
if .... then
begin
here the code to execute
if (I want to exit = TRUE) then
break or GOTO
here the code not to execute if has exited
end;
here the code to execute
end;