On Dec 26, 2006, at 8:20 PM, Charles A Gray wrote:

```
if number % 2 == 0
end
end
```

the printed values.

## I am running version 1.18.4 using scite in Ubuntu.

Charles G. – Phoenix, AZ; Where you can bake the chill out of your

bones

The value of the #step method is the initial value so that is being

returned from a.show_primes and presumably printed by whatever you’re

using to interpret your statements (like irb):

With your code in a file names “primes.rb”

$ irb -rprimes

a=Primes.new

=> #Primes:0x6e5d88

a.show_primes(1_000_000, 1_000_100)

1000003 1000033 1000037 1000039 1000081 1000099 => 1000001

a.show_primes(1_000_000, 1_000_100); nil

1000003 1000033 1000037 1000039 1000081 1000099 => nil

a.show_primes(1_000_000, 1_000_100); puts “”

1000003 1000033 1000037 1000039 1000081 1000099

=> nil

Note that the value of the last expression is displayed by irb

itself. (In the last example, the puts supplies a newline and the

value of puts as an expression is nil.)

To see the documentation for the step method (after first trying

Fixnum#step and Integer#step rather than looking it up in the

pickaxe

## $ ri -T Numeric#step

----------------------------------------------------------- Numeric#step

num.step(limit, step ) {|i| block } => num

```
Invokes _block_ with the sequence of numbers starting at _num_,
incremented by _step_ on each call. The loop finishes when the
value to be passed to the block is greater than _limit_ (if _step_
is positive) or less than _limit_ (if _step_ is negative). If all
the arguments are integers, the loop operates using an integer
counter. If any of the arguments are floating point numbers, all
are converted to floats, and the loop is executed _floor(n +
n*epsilon)+ 1_ times, where _n = (limit - num)/step_. Otherwise,
the loop starts at _num_, uses either the +<+ or +>+ operator to
compare the counter against _limit_, and increments itself using
the +++ operator.
1.step(10, 2) { |i| print i, " " }
Math::E.step(Math::PI, 0.2) { |f| print f, " " }
_produces:_
1 3 5 7 9
2.71828182845905 2.91828182845905 3.11828182845905
```

-Rob

Rob B. http://agileconsultingllc.com

removed_email_address@domain.invalid