Very basic for loop question

I want the for loop in the code below to run again after it has finished. How do I do that? I never really understood the uses of return, continue, and break.

		if(path.path.Count > this.gameObject.GetComponent<EnemyCombat>().actionPoints)
		{
			target = (Vector3)path.path[this.gameObject.GetComponent<EnemyCombat>().actionPoints].position; 
			path = seeker.StartPath (this.gameObject.transform.position, target, null);
			yield return StartCoroutine(path.WaitForPath()); 
			
			for(int i = 0; i < initiativeRollScript.combatants.Count; i++)
			{
				if(target == initiativeRollScript.combatants*.transform.position)*
  •  		{*
    

_ Vector3 tempTarget = initiativeRollScript.combatants*.transform.position;_
_
tempTarget.x += Random.Range(-1,1);_
_
tempTarget.z += Random.Range(-1,1);_
_
target = tempTarget;_
_
}_
_
}_
_
path = seeker.StartPath (this.gameObject.transform.position, target, null);_
_
yield return StartCoroutine(path.WaitForPath());_
_
}*_
The code is used in a turn based combat game I’m making. It’s designed to do two things: stop a path short if it has more nodes than the enemy has action points, and 2) find out if the shortened path lands on another combatant (enemy or player) and move to a random tile between -1and 1 on x and z that is not occupied.
At the moment, because the for loop only runs once, enemies still land on other combatants if the recalculated position is the same as a second combatant’s position. I need to keep running the for loop and change the target variable until the target location does not equal a combatant’s position.

Have you thought about using a do-While loop instead?
A do-While loop runs a block of code, then checks a condition, and if that condition is true, runs the block of code again until the condition returns false.

do{
  // Code to find new position here
} while (condition to check)

Put this in Update(), InvokeRepeating, etc.

You caould use like this if you for loop is

> for(int i=0;i<10;i++) 

{
if(i==9) {
> i=0;
`` }
}

You can also do like this:

 for(inti=0;i<length;i++)
{
   if(i==length-1)
  {
       i=0;//start the loop again
   }
 if(done)
 {
     break;//get out of the loop when the work is done
 }
}