Feature #4977: Improve for loop