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?
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.
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 and look for
‘puts’ in the right-hand column.