Help me understand this SIMPLE Ruby code, using puts in a def
- From: Fily Salas <fs_tigre@xxxxxxxxxxx>
- Date: Wed, 27 Apr 2011 15:25:48 -0500
Hi,
I was practicing ruby and accidentally came across something that got me
thinking (nothing important but I want to know why).
Why does the example-1 works and not example-2, if all I'm doing is
moving the puts?
Example-1:
def message
"this is working"
end
puts message.upcase
Example-2:
def message
puts "this is working"
end
message.upcase
Can someone explain this a little bit? I could just ignore it but I
would like to know the reason.
Thanks
--
Posted via http://www.ruby-forum.com/.
.
- Follow-Ups:
- Re: Help me understand this SIMPLE Ruby code, using puts in a def
- From: Fily Salas
- Re: Help me understand this SIMPLE Ruby code, using puts in a def
- From: Cee Joe
- Re: Help me understand this SIMPLE Ruby code, using puts in a def
- From: Roger Braun
- Re: Help me understand this SIMPLE Ruby code, using puts in a def
- From: Sam Duncan
- Re: Help me understand this SIMPLE Ruby code, using puts in a def
- Prev by Date: Bounty Request: small sample autoconf-like app/lib
- Next by Date: Re: Help me understand this SIMPLE Ruby code, using puts in a def
- Previous by thread: Bounty Request: small sample autoconf-like app/lib
- Next by thread: Re: Help me understand this SIMPLE Ruby code, using puts in a def
- Index(es):
Relevant Pages
|