No, because the foreach copies the range, then iterates over it. Meanwhile `range` in the function is left untouched.