# Programming ruby 1.9- question on page 37

**URL:** <https://www.ruby-forum.com/t/programming-ruby-1-9-question-on-page-37/179406>\
**Category:** Ruby\
**Created:** [November 24, 2009, 9:09am UTC](https://www.ruby-forum.com/t/programming-ruby-1-9-question-on-page-37/179406 "2009-11-24T09:09:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![4895](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/c5a1d2/32.png) [@4895](https://www.ruby-forum.com/u/4895)\
**Post date:** [November 24, 2009, 9:09am UTC](https://www.ruby-forum.com/t/programming-ruby-1-9-question-on-page-37/179406/1 "2009-11-24T09:09:38Z")

</div>

not sure what to do which that code at the bottom of page 37. I enter  
this code into the command prompt and obviously that isn’t right. I  
created the folder that I was told to before but I can’t remember it  
though I did skim a bit to find it. Not clear also on all that syntax  
that was used there. I have tried to get a good definition of puts for  
a month and have not been able  
to. If that is a method why is there another method (say\_goodnight  
(name)) on the same line?

Brad

---

<div class="post-metadata">

**Author:** ![4895](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/c5a1d2/32.png) [@4895](https://www.ruby-forum.com/u/4895)\
**Post date:** [November 24, 2009, 2:53pm UTC](https://www.ruby-forum.com/t/programming-ruby-1-9-question-on-page-37/179406/2 "2009-11-24T14:53:11Z")

</div>

On Tue, Nov 24, 2009 at 3:05 AM, 4895 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> not sure what to do which that code at the bottom of page 37. I enter  
> this code into the command prompt and obviously that isn’t right. I  
> created the folder that I was told to before but I can’t remember it  
> though I did skim a bit to find it. Not clear also on all that syntax  
> that was used there. I have tried to get a good definition of puts for  
> a month and have not been able  
> to. If that is a method why is there another method (say\_goodnight  
> (name)) on the same line?
> 
> Brad

Well the code under the box telling you where to download it (at least  
in the pdf version of the book, too lazy to go upstairs to look at the  
physical version) is a complete ruby program, either download it or  
enter it into a file they suggest intro5.rb,

And then just run it with:

```
ruby intro5.rb

```

Alternatively you can paste the text into irb.

puts say\_goodnight(“John boy”)

is the same as

puts(say\_goodnight(“John boy”))

and invokes the puts function passing the result returned by invoking  
say\_goodnight(“John boy”)

puts (p 575) is actually a method defined in the Kernel module which  
is available for all instances of subclasses of Object which includes  
Kernel.

But at this stage of the book, I believe that the author is just  
trying to give you the ‘flavor’ of Ruby, It might be better to just  
read the material, without trying to understand things too deeply.  
The picture will get clearer as you progress through the book.

–  
Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Twitter: [http://twitter.com/RickDeNatale](http://twitter.com/RickDeNatale)  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)

---

<div class="post-metadata">

**Author:** ![4895](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/c5a1d2/32.png) [@4895](https://www.ruby-forum.com/u/4895)\
**Post date:** [November 24, 2009, 12:01pm UTC](https://www.ruby-forum.com/t/programming-ruby-1-9-question-on-page-37/179406/3 "2009-11-24T12:01:34Z")

</div>

4895 wrote:

> not sure what to do which that code at the bottom of page 37. I enter  
> this code into the command prompt and obviously that isn’t right. I  
> created the folder that I was told to before but I can’t remember it  
> though I did skim a bit to find it. Not clear also on all that syntax  
> that was used there. I have tried to get a good definition of puts for  
> a month and have not been able  
> to.

For the benefit of those of use without the 1.9 version of the book, can  
you post the code you are trying to run, and the exception you get in  
response? I don’t think you will be held liable for copyright 🙂

For a definition of puts see [RDoc Documentation](http://www.ruby-doc.org/core/) and look for  
‘puts’ in the right-hand column.

Also the old version of Programming Ruby:  
[http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref\_m\_kernel.html#Kernel.puts](http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_m_kernel.html#Kernel.puts)  
[http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref\_c\_io.html#IO.puts](http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_c_io.html#IO.puts)

> If that is a method why is there another method (say\_goodnight  
> (name)) on the same line?

Perhaps what you are looking at is one method using the return value of  
another as a parameter. For example:

def foo  
123  
end

puts foo # same as: puts(foo())
