ما هو الفرق بين تعليمة abort وتعليمة break ؟
محمد ناشد
24-11-2004, 14:57
procedure Abort;
description
Terminates the current execution path without reporting an error.
Abort raises a so-called "silent exception" (EAbort), which does not display an error message to the user, redirecting execution to the end of the last try .. finally block.
example
//alow only numeric characters in an Edit box
procedure TForm1.Edit1KeyPress
(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9']) then Abort;
end;
procedure Break;
Immediately exits the iteration in which it appears.
The iteration assumes for, while, or repeat statements.
If a break occurs inside the try clause, the finally clause is entered.
example
var
S: string;
i:integer;
begin
for i:=0 to 100 do
begin
ReadLn(S);
if S = '' then Break;
WriteLn('This is not an empty string:' + S);
end;
end;
Reference
http://delphi.about.com/library/rtl/blrtlCATFlowControlRoutines.htm (http://delphi.about.com/library/rtl/blrtlCATFlowControlRoutines.htm)