for n := 0 to m - 1 do 
begin
 
end else
begin
//这里如果满足某个条件,如何返回for n := 0 to m - 1 do循环,不再执行后面的语句?
end;
//后面还有其他语句。

解决方案 »

  1.   

    if 满足条件 then
      break;
      

  2.   


    为什么用了break;后,循环就会停止了呢?
      

  3.   

    i:= 0;
    for n := i to m - 1 do 
    begin
      if ... then 
      begin
        i:= 0;
        goto ..
      end;
    end
      

  4.   


    begin
      for i := 0 to self.ListView3.Items.Count - 1 do begin
      ListView3.itemindex := 0;
      //其他.............
        if fileexists(target) then
        begin
          if application.MessageBox('文件已经存在要覆盖它吗?','Message!',mb_yesno)=mryes then
            application.ProcessMessages else 
          begin
          ListView3.Items.Delete(0);
          break;//这里点否后,就停止了,我是想如果有重复,就删除第一首,继续循环,要怎么做呢a
          end;
       end;
    //其他............
    end;
      

  5.   

    为什么不用while循环和
    n:=0;
    while n<M-1 do
    begin
     N:=N+1;
     IF 你要结束的条件 then
      N:=M;
    end;
    个人认为这样就可以了提前结束循环了
      

  6.   


    begin
      for i := 0 to self.ListView3.Items.Count - 1 do begin
      ListView3.itemindex := 0;
      //其他.............
        if fileexists(target) then
        begin
          if application.MessageBox('文件已经存在要覆盖它吗?','Message!',mb_yesno)=mryes then
            application.ProcessMessages else 
          begin
          ListView3.Items.Delete(0);
          continue; //用这个
          end;
       end;
    //其他............
    end;
      

  7.   

    continue;用过了,一样的,删除第一行就停止了
      

  8.   

    这种删除,一般是倒着循环的
    for i := self.ListView3.Items.Count - 1 downto 0 do begin