for loop with mutable variable