Delphi 语法基础[2] 异常、抛出异常raise
//例1:
begin
raise Exception.Create(‘抛出异常‘);
raise Exception.CreateFmt(‘%s %d‘, [‘错误代码:‘, 999]);
end;
//例2:
var
Excs: Exception;
begin
Excs := Exception.Create(‘发现异常‘);
raise Excs ;
end;
//例3:
begin
try
//
except
on e:exception do ShowMessage(e.Message);
end;
end;
创建时间:2020.12.25 更新时间: