function call and return

 

when you make a function call to a user defined function from within an iteration of a for loop, for instance for (i=1; i<10; i++) and after the 3rd iteration an if statement becomes true and makes a function call to the user defined function, does the program ruturn to the exact same position in the third iteration of that for loop after the return of the completed function or does it restart the for loop from the starting position of i=1 over again ?

 
SDC:

when you make a function call to a user defined function from within an iteration of a for loop, for instance for (i=1; i<10; i++) and after the 3rd iteration an if statement becomes true and makes a function call to the user defined function, does the program ruturn to the exact same position in the third iteration of that for loop after the return of the completed function or does it restart the for loop from the starting position of i=1 over again ?

Hi SDC,

AFAIK, if you don't put a break statement after the function, the loop will continue its iteration on the next 'i'. [added] Of course after finishing what operations are left between the function & the closing brace of the for loop.

'break' on the other hand will make the loop halt until next start() call (assuming it is inside start()); restarting the iteration from the beginning again. Hope that helps...

 

Thanks cameofx, I wanted my function call to return back to the loop and then continue through the rest of the cycles of the for statement, so even though as you said, it will start the next iteration of the loop rather than actually completing the third iteration when it returns, that will still work fine I'll just make sure I put my function call as the last neccessary operation in the loop.

 
SDC:

Thanks cameofx, I wanted my function call to return back to the loop and then continue through the rest of the cycles of the for statement, so even though as you said, it will start the next iteration of the loop rather than actually completing the third iteration when it returns, that will still work fine I'll just make sure I put my function call as the last neccessary operation in the loop.

I added new explanation few minutes ago, you must've missed it. You're expectation I've bolded is correct. My pleasure.
 

ah so it would complete the rest of the operations in the cycle of the i it was at before it made the function call, ok well thats going to work the way i wanted it to then ... im debugging my code so i wanted to make sure my assumptions on that point were correct, in my process of illimination thanks again cameo

Reason: