POV-Ray : Newsgroups : povray.pov4.discussion.general : I want to be rid of my stupid mistakes : Re: I want to be rid of my stupid mistakes Server Time
23 Apr 2024 19:43:58 EDT (-0400)
  Re: I want to be rid of my stupid mistakes  
From: Trevor G Quayle
Date: 20 Jul 2009 13:25:00
Message: <web.4a647edf97aca27181c811d20@news.povray.org>
"bgimeno" <bgimeno[at]persistencia[dot]org> wrote:
> The following code is perfectly valid to the present version, but does not
> produce anything.
>
> #declare FooCount = 0 ;
> #while (FooCount < 100 )
> sphere {<0,FooCount,0>,1 pigment { rgb< 1, 1, 0> } }
> // #declare FooCount = FooCount + 1 ; // note this missing line
> #end
>
> I suppose that a "detector" of infinite loops is it too much to ask?
>
> B. Gimeno

When I write a counting loop, I tend to do it as follows:

#declare FooCount = 0 ; #while (FooCount < 100 )
   > BLAH BLAH BLAH
#declare FooCount = FooCount + 1 ; #end

I know there are circumstances where this can't be done, but I find it helps me
recognize my "for" type loops easily.

-tgq


Post a reply to this message

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