It would be wiser to skip FOR and WHILE loops unless you initialise something during the initialisation phase of the software.
Maybe my thoughts on this are old fashioned but my experience is that incorrect use of FOR and WHILE loops during execution cause too much jitter/ consume too much cpu cycle time. Thus resulting in overall degraded performance of the controll application.
Some empiric tips, so no guarantees on them;
Never call FOR /WHILE loops cyclic and synchronous,
Define a low priority task for the FOR /WHILE loops and call it on EVENT base (asynchonous with callback),
Define initialisation phase which call FOR/WHILE loops only (synchonous /asynchronous),
Check start and endpoint (eg array boundries check) beforehand.