大家常用的try..finally..end,try..except..end的结构,先判断一下下面代码的执行结果,再实际测试一下看看
procedure TForm1.Button1Click(Sender: TObject);
begin
try
exit;
finally
ShowMessage('hoho');
end;
ShowMessage('hoho,exit!');
end;procedure TForm1.Button2Click(Sender: TObject);
begin
try
raise Exception.Create('Exception test');
except
ShowMessage('hoho');
end;
ShowMessage('hoho,exit!');
end;procedure TForm1.Button3Click(Sender: TObject);
begin
raise Exception.Create('Exception test');
ShowMessage('hoho,exit!');
end;procedure TForm1.Button4Click(Sender: TObject);
begin
try
raise Exception.Create('Exception test');
finally
ShowMessage('hoho');
end;
end;procedure TForm1.Button5Click(Sender: TObject);
begin
Button3Click(nil);
ShowMessage('hoho,exit');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
exit;
finally
ShowMessage('hoho');
end;
ShowMessage('hoho,exit!');
end;procedure TForm1.Button2Click(Sender: TObject);
begin
try
raise Exception.Create('Exception test');
except
ShowMessage('hoho');
end;
ShowMessage('hoho,exit!');
end;procedure TForm1.Button3Click(Sender: TObject);
begin
raise Exception.Create('Exception test');
ShowMessage('hoho,exit!');
end;procedure TForm1.Button4Click(Sender: TObject);
begin
try
raise Exception.Create('Exception test');
finally
ShowMessage('hoho');
end;
end;procedure TForm1.Button5Click(Sender: TObject);
begin
Button3Click(nil);
ShowMessage('hoho,exit');
end;
But Exit does not violate the flow of control dictated by a try..finally construct; if Exit is called inside the try clause, the finally clause is still executed.
所以,执行结果正确第2个道理一样,在TRY--EXCEPT里,执行TRY--EXCEPET的流程其他道理基本类似
具体看TRY--EXCEPT--FINALLY,会有结果的
合理的方式应该是:
Try--Finally--Except
1熟悉.SQLSERVERVER数据库开发2.熟悉DELPHI开发工具3.最好有参加ERP实施经验或者开发经验.4.外语一般.5.有数据库报表开发经验先6.待遇:3000-4000元/月左右。现本单位急招招聘 ERP程序员6.招聘人数:4男。7.工作地点:上海市闵行区。
职位,您的个人条件和求职意向与该职位招聘要求相符,因此同意来本单位参加面试。
面 试 时 间:从即日开始。
邮编:201103
附 近 交 通: 867,87,721,731,931,中卫线等
电 话 :021- 64019425、64050290、64019394、64051220 -2109 传真:64019417
备 注 : 面试时,请带好您的个人简历,以及相关的证明材料,如学历证书、职业资格证书、专业技术职称证书等。 面 试 地 点:上海市闵行区吴中路1375号
上海资顺科技有限公司(兴庚塑胶(上海)有限公司)
注:离上海很远的人最好不要应试。E-MAIL:[email protected]