让人头疼(100分)

  • 主题发起人 delphibird
  • 开始时间
D

delphibird

Unregistered / Unconfirmed
GUEST, unregistred user!
请看下面一段程序:
for i:=0 to 10do
begin
.......
if i=2 then
begin
showmessage('出错');
exit;
end;
end;
当I=2时,为了防止程序出错,用了EXIT 语句,可是FOR I :=0 TO 10这个
循环就不往下继续运行了。请问各位有什么办法,既可以防止程序出错,又可以
让先程序继续往下运行?
 
for i:=0 to 10do
begin

if i=2 then
begin
showmessage('出错');
// exit;
end
else
.......
end;
 
for i:=0 to 10do
begin
.......
if i=2 then
continue;
.......
end;
 
agree with Croco
 
试试用
try
.......
except
 
接受答案了.
 
玩游戏不遵守规则,确实让人头痛。
 
顶部