POV-Ray : Newsgroups : povray.newusers : Beginners code doesn't run : Re: Beginners code doesn't run Server Time 1 Oct 2023 19:11:42 EDT (-0400)
 Re: Beginners code doesn't run
 From: clipka Date: 1 Sep 2016 16:02:12 Message: <57c88944\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#57c88944%241%40news.povray.org",
"headline": "Re: Beginners code doesn't run",
"dateCreated": "2016-09-01T20:02:12+00:00",
"datePublished": "2016-09-01T20:02:12+00:00",
"author": {
"@type": "Person",
"name": "clipka"
}
}
Am 01.09.2016 um 21:54 schrieb Markus:

>     vertex_vectors {
>         vec
>
> #declare i = 0;
> #declare j = 0;
> #while(i<n)

you want to move the "#declare j = 0" into the outer loop.

>     #while(j<m)
>         #declare x1 = pow(i*r,5) * cos(5 * j * phi) - i * r * cos(j * phi);
>         #declare y1 = pow(i * r,5) * sin(5 * j * phi) - i * r * sin(j * phi);
>         #declare z1 = i*r + j*phi;
>
>         ,<x1,y1,z1>
>
>         #declare j = j + 1;
>     #end
>     #declare i = i + 1;
> #end

Also, presuming you are using POV-Ray 3.7, to avoid such mistakes you
can instead use the `#for` statement, which initializes and increments
the variable automatically.

#for(i,0,n-1)
#for(j,0,m-1)
...
#end
#end
```