# For-loop only executes first line in body [closed]

I have a simple For[] loop:

For[rPos = 0, rPos<=(2 N[Pi]), rPos += radiusInc,
zPotential = 0;
xPos = rDistance Cos[rPos];
yPos = rDistance Sin[rPos];
zPos = planeDepth;
AppendTo[zField, {xPos,yPos, zPos, zPotential}];
];


The only line of the body that is executed is:

zPotential = 0;


At the end, zField has zero items.

If I set a breakpoint on the second or third line it never hit.

I know that For[] and Do[] loops are discouraged, but I do not see the cause of this problem.

-

## closed as off-topic by Michael E2, Öskå, ubpdqn, Simon Woods, RunnyKineAug 17 '14 at 15:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Michael E2, Öskå, ubpdqn, Simon Woods, RunnyKine
If this question can be reworded to fit the rules in the help center, please edit the question.

Please post complete code that can be simply copied and pasted for testing. It's impossible to know what the problem is in your case because several definitions are missing. Please see sscce.org for useful guidelines. –  Szabolcs Jun 17 '14 at 19:50
Please do not cross post. I answered your question here community.wolfram.com/dashboard it is waste of people time. if you want to cross post, mention in each post where you posted as well, so people do not duplicate things. –  Nasser Jun 17 '14 at 20:08
@Nasser so what now? :P –  Kuba Jun 19 '14 at 8:27
@Nasser Could you post the link to your answer then, and maybe edit it into the post? –  Pickett Aug 17 '14 at 10:32
I'm voting to close because the question is incomplete. Also, it has been answered on the Wolfram Community site. –  Michael E2 Aug 17 '14 at 12:23

I post this to just illustrate alternative to For loop:
rDistance = 5.4;