From: Lloyd Linklater Date: 2009-07-25T05:27:07+09:00 Subject: using until I am writing a little thing to find all the prime numbers to a million. I got it to work this way: highestPrime = 1_000_000 primes = Array.new(highestPrime, true) currentNum = 3 while currentNum < highestPrime do (currentNum*currentNum).step(highestPrime, currentNum * 2) { |i| primes[i] = false } currentNum += 2 while primes[currentNum] == false do currentNum += 2 end end I am unhappy with using currentNum += 2 twice. I very much want to write something like this: while currentNum < highestPrime do (currentNum*currentNum).step(highestPrime, currentNum * 2) { |i| primes[i] = false } currentNum += 2 until primes[currentNum] == true end but that just hangs the program. What am I missing? -- Posted via http://www.ruby-forum.com/.