delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/03/01:02:10

From: bergeron AT vallnet DOT com (Joe User)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: BREAKing out of a nested loop
Date: Thu, 03 Aug 2000 04:49:41 GMT
Message-ID: <3988e66b.4161646@news.vallnet.com>
References: <3988bc46_2 AT spamkiller DOT newsfeeds DOT com>
X-Newsreader: Forte Free Agent 1.1/32.230
NNTP-Posting-Host: 208.134.118.30
X-Original-NNTP-Posting-Host: 208.134.118.30
X-Trace: 2 Aug 2000 23:47:26 -0500, 208.134.118.30
X-Original-Trace: 2 Aug 2000 23:47:26 -0500, 208.134.118.30
Lines: 40
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Try 'goto'.  You'll love it.  They never taught you about it in
school.

In comp.os.msdos.djgpp, on Wed, 2 Aug 2000 19:27:24 -0500,
"23yrold3yrold" <cbarry AT pangea DOT ca> wrote:

>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
>
>

- Raw text -


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