Understanding the "i" in 1.1


#1

https://www.codecademy.com/en/courses/ruby-beginner-en-ET4bU/0/1?curriculum_id=5059f8619189a5000201fbcb

I completely understand the prime number testing method in 1.1 except for the bit of code below. To my eyes, since "i" is never defined (that I can see), how can it be used to divide the number being tested? What is the value of "i" in this section of code?

for i in 2..n-1
    if n % i == 0

#2

Every number in the sequence 2, 3, 4... all the way to n-1. It starts with the first number, and i becomes that number, then it checks if n % i == 0, afterward it goes to the next number, and repeats the whole thing over again.


#3

Gotcha. That makes sense. I think I'm still not totally familiar with for and in. Thanks.