Any variables created inside of a loop are local to the loop. This means that once you exit the loop, the variable can no longer be accessed. If you want to use the variable after you left the loop, then you have to declare it before beforehand in the outer loop or method scope.