POV-Ray : Newsgroups : povray.advanced-users : #while loop help : Re: #while loop help Server Time
30 Jul 2024 00:27:49 EDT (-0400)
  Re: #while loop help  
From: Chris Huff
Date: 3 Sep 2000 17:08:25
Message: <chrishuff-F3A9F1.16100403092000@news.povray.org>
In article <8FA4E57A0seed7@204.213.191.228>, ing### [at] homenl (ingo) 
wrote:

> Think about it with an absolute non-programmer mind.

Easier said than done.


> When I first encouterd a loop, it took men an hour to realize that I had 
> to do the incrementing myself. I expected it to be automatic.

This is done for flexibility and ease of coding...a variable is just a 
variable, whether you use it as a counter or not, how is POV supposed to 
know it needs to be incremented when the loop ends? Also, there are 
times when you want to increment the loop by a different amount, and 
times when you don't even want to use an incrementing variable for 
control. Loops aren't only used for making several copies of an object.


> It took me a day to figure out I had to reset the counter of the inner 
> loop myself. For me it seemed very logical that once I had gone through 
> the loop the counter would not exist anymore until the loop was enterd 
> again.

This could make sense if you created the variable inside the outer loop 
in many other languages, but if you create it outside both loops, why 
would you expect it to be destroyed when the outer one loops back to 
it's start?
Anyway, POV seems to only have variables local to files and macros. With 
a separate keyword for modifying variables, like what my #set patch 
implements, it would be possible to use variables local to any block, 
like #if statements and #while loops, but I don't expect that to happen 
for a while, if ever.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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