Puts "#{expression}" braces always needed?

Silly me! I think I was trying it with local variables. Read Mark!


-----Original Message-----
From: ts [mailto:decoux@moulon.inra.fr]
Sent: Tuesday, October 01, 2002 10:33 AM
To: ruby-talk@ruby-lang.org
Cc: ruby-talk@ruby-lang.org
Subject: Re: puts “#{expression}” braces always needed?

The pickaxe book says (on page 51) that if the expression
is a global, class
or instance variable then the braces aren’t required.
Omitting them doesn’t
seem to work for me. Is the book wrong?

it seems to work for me

pigeon% ruby -e ‘$a = @@a = @a = 12; p “#$a #@@a #@a”’
“12 12 12”

Can you give an example ?

WARNING: All e-mail sent to and from this address will be received or
otherwise recorded by the A.G. Edwards corporate e-mail system and is
subject to archival, monitoring or review by, and/or disclosure to,
someone other than the recipient.