I did not understand what "i" is doing here. Is it executing for each "i"?
e.g. n=9 so is for each i between 2 and (9-1)=8 "n%i==0" executing or not? I mean for n=9, i= 2,3,4,5,6,7,8 respectively. For my understanding of modulo n%i==0 is_prime should be true. I would be very glad if you can help me.
def prime(n) puts "That's not an integer." unless n.is_a? Integer is_prime = true for i in 2..n-1 if n % i == 0 is_prime = false end end ...