From: Bala TS Date: 2011-05-27T13:59:32+09:00 Subject: Re: "Local variable within code blocks do not interfere with those outside the block" Josh Cheek wrote in post #1001405: > On Thu, May 26, 2011 at 11:11 PM, Bala TS > wrote: > >> Posted via http://www.ruby-forum.com/. >> >> > > r.to_s is equal to "#{r}", but more straightforward. So when you want to > convert something to a string, it is better to use its to_s method. > > The puts method, though, invokes the to_s method on the object before it > outputs it. So when you are sending an object to puts, you don't need to > worry about whether it is a string at all. > > puts "#{r}" # so rather than this > puts r # instead use this If you want to give some name string then puts r #is not work puts "value:#{r}" => result should come like this format value:1 value:2 value:3 value:4 value:5 like this way by bala(bdeveloper01) -- Posted via http://www.ruby-forum.com/.