POV-Ray : Newsgroups : povray.general : Array of points for use with bicubic patch : Re: Array of points for use with bicubic patch Server Time
26 Sep 2024 17:45:49 EDT (-0400)
  Re: Array of points for use with bicubic patch  
From: D103
Date: 6 May 2011 09:45:01
Message: <web.4dc3fa362d1676e45ae2687f0@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:
.....
>
> When making nested loops, it's normaly beter to initiate any inner loop
> counter just before it's #while statement.
>
> You initiate your counter first outside the outer loop. Then, you
> reinitiate that counter for the next iteration after the #end of the
> loop and after you increment the outer loop's counter.
>
> The usual way is:
> Initiate the outer loop's counter.
> Start the outer loop.
> possibly do some stuff.
>
> Initiate the iner loop's counter.
> Start the inner loop.
> Do the iner loop's stuf and counter incrementation.
> Close the iner loop.
>
> possibly do some other outer loop stuff.
> Increment the outer loop's counter.
> Close the outer loop.
>
> This is much cleaner as the iner loop is initiated just before the place
> where it's used.
> You only need to initialise the iner loop in one place.
> You can use a #local variable for the iner loop instead of one that is
> global. It reduces the risks of name collision and undesirable side effects.
>
>
>
> Alain

Ah. I don't know why I didn't understand before.
Oh well, better late than never.

Thanks guys,
D103


Post a reply to this message

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