Re: Beginner question

Thank you everyone for all the replies. I think I understand that now.

Coming to Ruby from Perl, bare variables have been a point of confusion
for me. Heck, I started out just messing with existing scripts, and
until I started looking at real documentation I had just assumed that
all variables were shown as variables by the #{} notation.

This was a big help. As I said, Google was hard with this one as I had
no context and my search terms were too vague.


----- Original Message ----
From: Avida N. [email protected]
To: ruby-talk ML [email protected]
Sent: Friday, May 18, 2007 10:25:24 AM
Subject: Re: Beginner question

hello Guys,

let me give another example. let say you want to create a greeting base
on a
person name. You will write:

def greetings(name)
“Good Morning #{name.capitalize}”

puts greetings(‘loi’)
“Good Morning Loi”

as you can see the #{} allows you to create complex expressions. In this
case you were able to capitilize the name Loi even though you entered it
lower case letter. So when the interpreter does the interpolation sees
method capitalize and capitalize the name for you.

I hope this example will help you

Carlos Henriquez

On 5/18/07, Sebastian H. [email protected] wrote:

This will return (of course) print out “The number is x” because ruby has

Ist so, weil ist so
Bleibt so, weil war so

for a deal? Find great prices on flights and hotels with Yahoo!