How to repeat some code logic in UE C++?

I need to repeat this code if the condition is false.
I need to use goto or just recall the function under the if statement as I did? what is the best practice?

//Randomize Transforms of spawn Locations 
RandomLocation(InGetAllTransformsRef, OutGetAllTransformsRef); 

//look for already randomize spawn array if == -1 , repeat randomizing
if (UsedLocations.Find(OutGetAllTransformsRef) == -1)
{
	RandomLocation(InGetAllTransformsRef, OutGetAllTransformsRef);
}
else
{
	//some Code to continue the logic
}

Use a while loop

while (condition == false)
{
    // do some stuff
)
2 Likes

very good point, thank you Sir for correcting me, you just solved my problem :slight_smile: