From: Time World Date: 2009-01-19T06:56:36+09:00 Subject: Re: Why eval is not failing in the third case ( c3) ------=_Part_7642_32526587.1232315878771 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 2009/1/18 Raj Singh > >> c1 = 'hello' > >> eval c1 > NameError: undefined local variable or method `hello' for main:Object > > >> c2 = 'hello #{hi}' > => "hello \#{hi}" > >> eval c2 > NameError: undefined local variable or method `hello' for main:Object > > >> c3 = '#{hi} hello' > => "\#{hi} hello" > >> eval c3 > => nil > > > My question is why the eval of c3 is returning nil. It should fail > saying that undefined local variable just as it did in the case of c2 ? It's evaluated as a comment: #hi hello If you want #{hi} to be replaced by the content of the variable hi, you should use double quotes: c4 = "#{hi} hello" ------=_Part_7642_32526587.1232315878771--