p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Ruby on Rails (http://p2p.wrox.com/forumdisplay.php?f=289)
-   -   ruby on rails>>chomp (http://p2p.wrox.com/showthread.php?t=55441)

ckonrad March 15th, 2007 05:46 PM

ruby on rails>>chomp
 
on p 17 of begining ruby on rails by holzner, he talks about how you cant use the chomp method with any other variable than the built $_ variable and goes on to demonstrate this very strange and convoluted code example:

print "Please enter the temperature: "
temperature = gets
$_ = temperature
chomp
temperature = $_
puts "The temperature is #{temperature}

That code above is just insane, one of the main points of ruby is making things simple

why not try this code instead

print "Please enter the temperature: "
puts "The temperature is #{gets.chomp}. This is after the chomp"

or to demonstrate that the author is in fact wrong about why he needed to create that convoluted code example why not do it like this

print "Please enter the temperature:"
temp = gets
puts "The temperature is #{temp.chomp}. this is after the chomp"

that works fine even though he says it shouldn't. I dont know if i want to use a book to learn something new from an author who makes a simple error like this, how many more errors are there in the book? who knows.


hquach March 15th, 2007 06:51 PM

================================================== =================
I dont know if i want to use a book to learn something new from an author who makes a simple error like this, how many more errors are there in the book? who knows.
================================================== =================

*I agree

Anyone know any good 'Ruby on Rails' books for beginners? I'm starting to get fed up w/ this one...

ciderpunx March 16th, 2007 05:49 AM

The O'Reilly one is pretty good. Agile web development with RoR IRIC.

--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk

hquach March 16th, 2007 02:05 PM

any major errors with the O'Reilly? I'm looking through the Errata section, it seems like it has the same amount of errors as this book.


ciderpunx March 28th, 2007 02:24 AM

Might be fixed in the second edition?

--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk


All times are GMT -4. The time now is 09:46 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.