This could be go outside of the loop. By this way only at finish the var is assigned.