Forum: Ruby Re: Beginner question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
jim o (Guest)
on 2007-05-19 02:04
(Received via mailing list)
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.

Thanks!
Jim

----- Original Message ----
From: Avida N. <removed_email_address@domain.invalid>
To: ruby-talk ML <removed_email_address@domain.invalid>
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}"
end

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
in
lower case letter. So when the interpreter does the interpolation sees
the
method capitalize and capitalize the name for you.

I hope this example will help you

Carlos Henriquez

On 5/18/07, Sebastian H. <removed_email_address@domain.invalid> 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
>
>








____________________________________________________________________________________Looking
for a deal? Find great prices on flights and hotels with Yahoo!
FareChase.
http://farechase.yahoo.com/
This topic is locked and can not be replied to.