delphi 第4课

try
语句;(正常)
except
语句;
(意外处理部分)

end;

例子:

begin  
  sum:=0;
   try  
     n:=strtoint(edit1.Text);
   except 
      showMessage('请输入一个整数');
      exit;
   end;
   i:=1;
   while i<=n do
    sum:sum+i;
   i:=i+1;
end;

变量作用域

 2018-04-23 22:02:11 

猜你喜欢

转载自www.cnblogs.com/guangzhou11/p/8922113.html