From: Xavier Noria Date: 2012-10-01T00:53:26+09:00 Subject: Re: prime numbers problem --047d7b10cfeb091f0204caed4a29 Content-Type: text/plain; charset=UTF-8 On Sun, Sep 30, 2012 at 5:48 PM, Roelof Wobben wrote: Hello, > > I found out that ruby 1.9 has a prime class. > So I tried this : list_primes.each { |prime| print prime, " "; break > unless prime < 90 } > > And I get this answer : 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 > 67 71 73 79 83 89 97 > > That looks no good because 97 is more then 90. > > How can this be happen ? > Because the loop first print, and checks later. --047d7b10cfeb091f0204caed4a29 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, Sep 30, 2012 at 5:48 PM, Roelof Wobben <rwobben@hotmail.com&= gt; wrote:

=C2=A0Hello,

I found out that ruby 1.9 has a prime class.
So I t= ried this : list_primes.each { |prime| print prime, " "; break un= less prime < 90 }

And I get this answer : 2 3 5 7 11 13 17 19 23 = 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

That looks no good because 97 is more then 90.

How can this be h= appen ?

Because the loop first = print, and checks later.
=C2=A0
--047d7b10cfeb091f0204caed4a29--