str = "#$"
-:1: unterminated string meets end of file
Is there is something special about this sequence? '#$' is fine.
···
--
Posted via http://www.ruby-forum.com/.
str = "#$"
-:1: unterminated string meets end of file
Is there is something special about this sequence? '#$' is fine.
--
Posted via http://www.ruby-forum.com/.
When you're referring to a variable with a sigil ($global, @instance),
you can omit the {} in string interpolation. Thus:
foo = "local"
@foo = "ivar"
$foo = "global"
"local: #foo, ivar: #@foo, global: #$foo"
=> "local: #foo, ivar: ivar, global: global"
So, yes, there is something special about "#$"
Ben
On Mon, Jan 10, 2011 at 1:06 PM, Siep Korteling <s.korteling@gmail.com> wrote:
str = "#$"
-:1: unterminated string meets end of file
Is there is something special about this sequence? '#$' is fine.
Just to be a bit more explicit...
There is a global variable named $"
So in Siep's example, the parser is using the second quote as the name of the global variable and not as the closing quote for the string literal.
Gary Wright
On Jan 10, 2011, at 4:10 PM, Ben Bleything wrote:
On Mon, Jan 10, 2011 at 1:06 PM, Siep Korteling <s.korteling@gmail.com> wrote:
str = "#$"
So, yes, there is something special about "#$"