POV-Ray : Newsgroups : povray.advanced-users : Break out of main while (1) loop using #break directive in a sub-loop state= : Re: Break out of main while (1) loop using #break directive in a sub-loop state= Server Time
4 Feb 2023 23:24:57 EST (-0500)
  Re: Break out of main while (1) loop using #break directive in a sub-loop state=  
From: kurtz le pirate
Date: 16 Jan 2023 12:34:46
Message: <63c58ab6$1@news.povray.org>
On 16/01/2023 02:05, Bald Eagle wrote:
> So, clearly the flow control in this other language is different than SDL,
> 
> I have a while (1) with an #if, and then other little nested bits like:
> 
> #if (A >= 0)
>      #for (m, 0, 3)
>           #if (tris[A][m]=R){
>                #local tris[A][m]=L;
>                #break;
>           #end
>      #end
> #end
> 
> I'm assuming some, or all of those #break statements are meant to exit the
> #while(1), but of course, they don't, and so I'm stuck in the dreaded infinite
> loop.
> 
> Please advise.
> 

I agree with Tor Olav. The "break" breaks the logic of the code.
However, we can arrange it with something like :

#declare DoLoop = true;
#while ( (condition) & DoLoop)
  ...
  ...
  #if ( exit_condition )
    #declare DoLoop=false;
  #end
#end






-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.