It's not a good idea to declare variables inside a loop. Put the definition outside and reassign it inside the loop