Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #3579
| From | Cee Joe <cyril_jose@ymail.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: Help me understand this SIMPLE Ruby code, using puts in a def |
| Date | 2011-04-27 15:47 -0500 |
| Organization | Service de news de lacave.net |
| Message-ID | <0d5b885d71f3b1d93f93f2b42090d5f4@ruby-forum.com> (permalink) |
| References | <bde5d72cb289acdd7b880c6c83869049@ruby-forum.com> |
I agree with Sam: >> def message >> "this is working" >> end => nil >> puts message.upcase THIS IS WORKING => nil >> def message1 >> puts "this is working" >> end => nil >> puts message1 this is working nil <----- extra nil => nil Since the nil is the last thing that is read in the method, upcase is called on that nil and upcase throws an error b/c you can't use that method on a nil. Make sense? -Cee -- Posted via http://www.ruby-forum.com/.
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help me understand this SIMPLE Ruby code, using puts in a def Fily Salas <fs_tigre@hotmail.com> - 2011-04-27 15:25 -0500 Re: Help me understand this SIMPLE Ruby code, using puts in a def Sam Duncan <sduncan@wetafx.co.nz> - 2011-04-27 15:35 -0500 Re: Help me understand this SIMPLE Ruby code, using puts in a def Roger Braun <roger@rogerbraun.net> - 2011-04-27 15:41 -0500 Re: Help me understand this SIMPLE Ruby code, using puts in a def Cee Joe <cyril_jose@ymail.com> - 2011-04-27 15:47 -0500 Re: Help me understand this SIMPLE Ruby code, using puts in a def Fily Salas <fs_tigre@hotmail.com> - 2011-04-27 18:38 -0500
csiph-web