POV-Ray : Newsgroups : povray.newusers : Beginners code doesn't run : Re: Beginners code doesn't run Server Time 1 Oct 2023 18:27:02 EDT (-0400)
 Re: Beginners code doesn't run
 From: Markus Date: 2 Sep 2016 02:30:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.57c91c64786d177f4066f2170%40news.povray.org",
"headline": "Re: Beginners code doesn't run",
"dateCreated": "2016-09-02T06:30:00+00:00",
"datePublished": "2016-09-02T06:30:00+00:00",
"author": {
"@type": "Person",
"name": "Markus"
}
}
clipka <ano### [at] anonymousorg> wrote:
> 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

Thanks, this helped :-)
```