From: "Marp" Newsgroups: comp.os.msdos.djgpp Subject: Re: BREAKing out of a nested loop Date: Wed, 2 Aug 2000 23:53:15 -0400 Organization: MindSpring Enterprises Lines: 40 Message-ID: <8maq9t$99i$1@slb6.atl.mindspring.net> References: <3988bc46_2 AT spamkiller DOT newsfeeds DOT com> NNTP-Posting-Host: 04.30.99.91 X-Server-Date: 3 Aug 2000 03:52:29 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com See my other post first please. I forgot to say that you could put a = pptest_w + 1; just before you use break. That would cause the outer loop to terminate. "23yrold3yrold" wrote in message news:3988bc46_2 AT spamkiller DOT newsfeeds DOT com... > Hullo. I would like a little help with something. I've written a simple > collision-detection program, but I need a little clarification with > something: > > > for(int a = 1; a <= pptest_w; a++){ > for(int b = 1; b <= pptest_h; b++){ > pixelcheck = getpixel(pptest_1a, a, b); > if(pixelcheck <= 0){ > }else if(pixelcheck != 0){ > pixelcheck = getpixel(pptest_2a, a, b); > if(pixelcheck <= 0){ > }else if(pixelcheck != 0){ > collide = 1; > break; > } > } > } > } > > FUNKtion(); > > I would like to get it to break as soon as a collision is detected and go > straight to FUNKtion(). Is this enough to bust out of all those nested > loops? Putting if(collide){break;} latter in that mess would be kind of > stupid because you're just putting it in another loop, correct? Any help > will be appreciated. Thank you. > > > Chris > >