Better to keep this variable declaration inside the loop as it changes on every loop iteration. Having it declared inside the loop ensures that it's value can't "leak" from one iteration to another