# A Ruby Book (free to use)

Hello people, I have written a book on Ruby programming language.

On 08/22/2012 08:10 AM, Karthikeyan A k wrote:

Hello people, I have written a book on Ruby programming language.

Thanks for sharing your work and esp. for the lovely “Math Discovery” at
p. 162

regards
ralf

On Wed, Aug 22, 2012 at 9:38 AM, Ralf M. [email protected]
wrote:

On 08/22/2012 08:10 AM, Karthikeyan A k wrote:

Hello people, I have written a book on Ruby programming language.

Thanks for sharing your work and esp. for the lovely “Math Discovery” at p.
162

It is well known for a long time that you can prove anything if you
manage to sneak a division by zero into your proof. Various fun
proofs have been built around this. Note also that this has nothing
to do with how computers do math.

Kind regards

robert

Am 22.08.2012 08:10, schrieb Karthikeyan A k:

Hello people, I have written a book on Ruby programming language.

Though appreciating the effort that was put into this,
I would not recommend this at the moment as a good starting
point for beginners. There is still a lot of work to be done.

I only browsed a couple of pages and I found:

• a wrong algorithm (on p. 32)

# finds the greatest of three numbers

a,b,c = 3,7,5
if a > b and a > c
puts “a = #{a} is greatest”
elsif b > c and b > a
puts “b = #{b} is greatest”
else puts “c = #{c} is greatest”
end

Now try that with a,b,c = 4,4,3 !
=> c = 3 is greatest

• doubtful simplifications and half-truths:

“The p is a kind of short form for puts.” (p. 33)

“Note that if we use else with unless we must terminate
the unless block with an end command.” (p. 34)

• antipatterns (unless…else) (on p. 34):

unless age < 18 or age > 35
p “You can enter Armed forces”
else p “You cannot enter Army. You are either too young or too
old”
end

This highly confusing usage of unless finds its counterpart in
sentences like “Let say that one is not a major and is considered
a child unless he or she is less than 18 years old.”
(Which is wrong, by the way.)

• a programming style (indentations, …) that does not follow the
highly reasonable style widely established in the Ruby community
(see above examples)

On Wed, Aug 22, 2012 at 1:10 AM, Karthikeyan A k [email protected]
wrote:

Hello people, I have written a book on Ruby programming language.

Thanks so much! I haven’t had time to look at most of it, but I notice
there are missing hyphens in some code sections, e.g. all of these on
p. 10:

\$ sudo apt­get install build­essential bison openssl libreadline6
dev curl git­core zlib1g zlib1g­dev libssl­dev libyaml­dev libsqlite3­0
libsqlite3­dev sqlite3 libxml2­dev libxslt­dev autoconf libc6­dev
ncurses­dev
automake

and:

\$ curl ­L https://get.rvm.io | bash ­s stable ­­ruby

and:

\$ echo '[[ ­s “\$HOME/.rvm/scripts/rvm” ]] && . “\$HOME/.rvm/scripts/rvm”

RVM function’ >> ~/.bashrc

and:

\$ ruby ­v

On 08/22/2012 10:19 AM, Robert K. wrote:

to do with how computers do math.
Sure, it hasn’t. You can proof everything out of something wrong, e.g.
my math teacher proofed that he is the
pope out of 1 = 2

Thanks for this book !

On 22 Αυγ 2012, at 09:10 , Karthikeyan A k [email protected] wrote:

Hello people, I have written a book on Ruby programming language.

Hello,

Thanks for the effort and for supplying an entire book for free. Is it
possible to have .mobi and/or .epub versions?

Best Regards,

Posted via http://www.ruby-forum.com/.

Panagiotis A.

To avoid this problem, use this file
https://raw.github.com/mindaslab/ilrx/master/ruby_install.bash

Eric C. wrote in post #1073242:

On Wed, Aug 22, 2012 at 1:10 AM, Karthikeyan A k [email protected]
wrote:

Hello people, I have written a book on Ruby programming language.

Thanks so much! I haven’t had time to look at most of it, but I notice
there are missing hyphens in some code sections, e.g. all of these on
p. 10:

\$ sudo apt­get install build­essential bison openssl libreadline6
…s/rvm" ]] && . “\$HOME/.rvm/scripts/rvm”

RVM function’ >> ~/.bashrc

and:

\$ ruby ­v

OK, fixed the bug on page 32, but others… I think that’s OK. Thanks,
spot more.

unknown wrote in post #1073171:

Am 22.08.2012 08:10, schrieb Karthikeyan A k:

Hello people, I have written a book on Ruby programming language.

Though appreciating the effort that was put into this,

I only browsed a couple of pages and I found:

• a wrong algorithm (on p. 32)

# finds the greatest of three numbers

a,b,c = 3,7,5

else puts “c = #{c} is greatest”
end

Now try that with a,b,c = 4,4,3 !
=> c = 3 is greatest

end