POV-Ray : Newsgroups : povray.general : Why does POV always evaluate both expressions with a '&'? : Re: Why does POV always evaluate both expressions with a '&'? Server Time
20 Nov 2024 10:28:25 EST (-0500)
  Re: Why does POV always evaluate both expressions with a '&'?  
From: Micha Riser
Date: 27 Sep 2001 12:44:36
Message: <2vkvo9.tj4.ln@micha.riser>
Thorsten Froehlich wrote:

> exceptions, but that is not the point).  The example you provide is simply
> extremely bad programming style and it is neither a bug nor a limitation
> on part of POV-Ray that the above does not work.

If it is that bad programming style, how to do it the good way?? More 
specific:

Return the first non-zero position of an array of length n - or if it is 
all zero return n.

Can you do it without extra variable?

One solution working in pov is:

#declare goon=1;
#declare i=0;
#while ((i<n)&(goon=1))
        #if (a[i]=0)
                #declare i=i+1;
        #else
                #declare goon=0;
        #end
#end

So this can impossible be better style. Please enlighten me with your 
solution.


Post a reply to this message

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