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
7 Aug 2024 17:26:11 EDT (-0400)
  Re: Why does POV always evaluate both expressions with a '&'?  
From: Chaps
Date: 27 Sep 2001 14:00:35
Message: <3bb36943$1@news.povray.org>
what is the use of goon?

I would just write:

 #declare i=0;
 #while (i<n)
         #if (a[i]=0) // this will not be evaluated if i = n
                 #declare i=i+1;
         #end
 #end

"Micha Riser" <mri### [at] gmxnet> wrote in message
news:2vk### [at] michariser...
> 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.