Breaking inner loops

Giganews Newsgroups
Subject: Breaking inner loops
Posted by:  Mr. X (…@mail.here)
Date: Thu, 30 Mar 2006

Hi
I have a situation where i have nested loops like this :

procedure DoLoop;
begin
    for i := 0 to Count1 -1 do
    begin
        if (some condition) then
        begin
          for j := 0 to Count2 -1 do
          begin
              {......do something here....}
              if (a value is found) then
              Break;
          end;
        end;
    end;
end;

.................

So here i want to break only the "j" loop when i meet a condition (when a
value is found) but carry on with the "i " loop.
is this code snippet correct ??

Regards
X

Replies