Right. But never use:
"#{var}"
I thought #{var} was used within quotes to get the value as otherwise you just get var...
var = "Hello Ruby Talk World"
"I just wanted to say #{var}" -> I just wanted to say Hello Ruby Talk World
"I just wanted to say var" -> I just wanted to say var
or am I missing the point?
To me it's easier to do the above and much cleaner than the following:
print "I just wanted to say " + var + ", love the slippers!"
Or am I just showing my ant roots again...? ${var}
Gem
···
-----Original Message-----
From: list-bounce@example.com [mailto:list-bounce@example.com]On Behalf
Of Peter Bailey
Sent: 15 August 2006 15:19
To: ruby-talk ML
Subject: Re: Trouble parsing against a hash
*** WARNING ***
This mail has originated outside your organization,
either from an external partner or the Global Internet.
Keep this in mind if you answer this message.
James Gray wrote:
On Aug 15, 2006, at 8:14 AM, Peter Bailey wrote:
You mean, it's because I was simply missing quotes around my "#{}"
expression that it was regarded as a comment? Well, I guess I can
certainly understand that. Thanks a lot.Right. But never use:
"#{var}"
because that's just a confusing way to say:
var.to_s
And if the variable is already a String, you really just want:
var
James Edward Gray II
OK. I'm a bit confused, though. I've been using #{var} for quite a while
now. I thought it was needed when getting a variable within a block. Is
it when it's in double quotes that you suggest not using it?
--
Posted via http://www.ruby-forum.com/\.
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************