Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #5134
| From | Bala TS <bdeveloper01@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: "Local variable within code blocks do not interfere with those outside the block" |
| Date | 2011-05-26 23:59 -0500 |
| Organization | Service de news de lacave.net |
| Message-ID | <ee531e9473b95cc60cf46a94b66a52fe@ruby-forum.com> (permalink) |
| References | <973cac1dd063c9b58788432c1267c14e@ruby-forum.com> <abfa84bb4771ac3dbd1e84a4d798507a@ruby-forum.com> <BANLkTi=EKZUC_4EeBw+-j4syPrx6hPjrLw@mail.gmail.com> |
Josh Cheek wrote in post #1001405:
> On Thu, May 26, 2011 at 11:11 PM, Bala TS <bdeveloper01@yahoo.com>
> 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/.
Back to comp.lang.ruby | Previous | Next — Previous in thread | Find similar | Unroll thread
"Local variable within code blocks do not interfere with those outside the block" Kaye Ng <sbstn26@yahoo.com> - 2011-05-24 04:45 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Adam Prescott <adam@aprescott.com> - 2011-05-24 05:08 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Adam Prescott <adam@aprescott.com> - 2011-05-24 05:16 -0500
to Adam Prescott, Kaye Ng <sbstn26@yahoo.com> - 2011-05-26 02:42 -0500
Re: to Adam Prescott, Adam Prescott <adam@aprescott.com> - 2011-05-26 04:17 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 04:20 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Josh Cheek <josh.cheek@gmail.com> - 2011-05-26 04:57 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Adam Prescott <adam@aprescott.com> - 2011-05-26 05:05 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 07:46 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 23:09 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 23:11 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Josh Cheek <josh.cheek@gmail.com> - 2011-05-26 23:30 -0500
Re: "Local variable within code blocks do not interfere with those outside the block" Bala TS <bdeveloper01@yahoo.com> - 2011-05-26 23:59 -0500
csiph-web