XtendFor wrapper
contert for loop to while where nessesary. fixes #14