------art_11772_28288834.1203936692559
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Mon, Feb 25, 2008 at 12:03 PM, 7stud -- <bbxx789_05ss / yahoo.com> wrote:

> class Dog
>  def secret_codeeed)
>    @secret_code  eed * 10 + 2
>  end
> end
>
> d  og.new
> return_val  d.secret_code) )
> puts return_val    #should this reveal the secret code?
>

Yes. What would you like it to return? The point is, you're doing
d.secret_code   -- you're saying the secret code *is* 3, so actually
setting it to something else is a bit misleading, don't you think?

class Dog
  def generate_secret_code(seed)
    @secret_code  eed * 10 + 2
    self
  end
end

This has the fun of allowing method chaining;
d  og.new
d.generate_secret_code(3).some_other_method_that_chains.yet_another(some,
args)

Arlen

------art_11772_28288834.1203936692559--