1/异常处理
procedure TForm1.Button1Click(Sender: TObject);
var
Order: TextFile;
I: Integer;
begin
AssignFile(Order,'c:/Order.txt');
Rewrite(Order);
try
try
for I := 1 to 100 do
Writeln(Order,'第'+IntToStr(I)+'行');
Writeln(Order,'AAAAAAAAAAa');
finally
CloseFile(Order);
end;
Showmessage('设置保存成功!');
except
Showmessage('配置保存失败!请重试');
end;
end;
2、abort例子
procedure TForm1.Button2Click(Sender: TObject);
var:i,j:integer;
begin
i:=1;
if i=1 then
begin
abort;
end;
j:=2;
end;
上面的代码j:=2;就不会执行
i:=1时就跳出来了