What does the step() method do

I have to write a program to implement the Sieve of Erastosthenes
algorithm for finding the prime nos.
I got the following code on scriptol.org

top = 100
sieve = []
for i in 2 .. top
  sieve[i] = i
end

for i in 2 .. Math.sqrt(top)
  next unless sieve[i]
  (i*i).step(top, i) do |j|
    sieve[j] = nil
  end
end
puts sieve

Can someone please tell me what's happening in the lines
next unless sieve[i]
(i*i).step(top,i) do |j|
   sieve[j]=nil

···

--
Posted via http://www.ruby-forum.com/.

0.step(8, 3) do |i|
  puts i
end

--output:--
0
3
6

···

--
Posted via http://www.ruby-forum.com/.