delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/03/18:45:17

From: gdemont AT my-deja DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: BREAKing out of a nested loop
Date: Thu, 03 Aug 2000 14:03:11 GMT
Organization: Deja.com - Before you buy.
Lines: 30
Message-ID: <8mbu2q$p3e$1@nnrp1.deja.com>
References: <3988bc46_2 AT spamkiller DOT newsfeeds DOT com>
NNTP-Posting-Host: 130.125.13.32
X-Article-Creation-Date: Thu Aug 03 14:03:11 2000 GMT
X-Http-User-Agent: Mozilla/4.74 (Macintosh; U; PPC)
X-Http-Proxy: 1.0 x67.deja.com:80 (Squid/1.1.22) for client 130.125.13.32
X-MyDeja-Info: XMYDJUIDgdemont
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

You are looking for a named loop - in *** you would write
it as:

main_detect:
for a in 1..pptest_w loop
   for b in 1..pptest_h loop
      pixelcheck:= getpixel(pptest_1a, a, b);
      if pixelcheck <= 0 then
      elsif pixelcheck /= 0 then
         pixelcheck:= getpixel(pptest_2a, a, b);
         if pixelcheck <= 0 then
         elsif pixelcheck /= 0 then
            collide:= 1;
            exit main_detect;
         end if;
      end if;
   end loop;
end loop main_detect;

FUNKtion;

In absence of named loops the "goto" is the most suited (not
dangerous for _exiting_ structures) IMHO...

______________________________________________________
Gautier  --  http://members.xoom.com/gdemont/gsoft.htm


Sent via Deja.com http://www.deja.com/
Before you buy.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019