[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Beginner with a question.

Tim Pease

8/3/2007 5:12:00 PM

On 8/3/07, clockwork@sigsys.org <clockwork@sigsys.org> wrote:
>
> So what sort of silly syntactical error am I making ?
>

Ruby does not implicitly convert Integers into Strings. You need to
explicitly tell Ruby this is what you are doing.

puts "Try #{finalnum} instead"

Inside double quoted strings, anything inside a #{ } delimiter is
treated as Ruby code, and it is evaluated by the interpreter and
converted into a string. So you could also write (as you did
originally)

puts "Try #{favnum + plus1} has the result."

Hope that makes sense. Oh, and welcome to Ruby!

Blessings,
TwP

1 Answer

Tim Pease

8/3/2007 6:27:00 PM

0

On 8/3/07, clockwork@sigsys.org <clockwork@sigsys.org> wrote:
> Awesome. Thanks.
>
> Whats the difference between single and double quoted strings in ruby ?
>

Take a look at this section on Strings from the Programming Ruby book ...

http://www.rubycentral.com/pickaxe/langua...

That will answer your question in much greater detail than I could in
this short mailing list post.

Blessings,
TwP