Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #7218
| Path | csiph.com!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Sebastian Christ <rudolfo.christ@gmail.com> |
| Newsgroups | comp.lang.ruby |
| Subject | Re: "Put" in Ruby |
| Date | Fri, 15 Apr 2016 20:57:11 +0200 |
| Organization | Aioe.org NNTP Server |
| Lines | 27 |
| Message-ID | <m2inziaeew.fsf@gmail.com> (permalink) |
| References | <d720c9a9-3943-45d9-83a1-ff3cf224aaef@googlegroups.com> |
| NNTP-Posting-Host | fGpK5fCdZh0seASrtEKZmQ.user.gioia.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) |
| Cancel-Lock | sha1:Crn9EVFnQaZiiVzvuU/upEcifaA= |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| Xref | csiph.com comp.lang.ruby:7218 |
Show key headers only | View raw
On 2016-04-15 8:23, Cai Gengyang <gengyangcai@gmail.com> wrote:
> First off, puts is not a function. It's sole purpose is to have a
> side-effect (printing something to the console), whereas functions
> cannot have side-effects ... that's the definition of "function",
> after all.
>
> Ruby doesn't have functions. It only has methods. Thus, puts is a method.
>
> Is this true ? So basically, 'puts' is just a "thing" to enable printing something to the console ...
irb(main):001:0> RUBY_VERSION
=> "2.3.0"
irb(main):002:0> puts.class
=> NilClass
irb(main):003:0>
Looks like `puts' is an instance of NilClass. And therefore an object.
Regards,
Sebastian
--
Sebastian (Rudolfo) Christ
http://rudolfochrist.github.io
GPG Fingerprint: 306D 8FD3 DFB6 4E44 5061
CE71 6407 D6F8 2AC5 55DD
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar
"Put" in Ruby Cai Gengyang <gengyangcai@gmail.com> - 2016-04-15 08:23 -0700
Re: "Put" in Ruby Sebastian Christ <rudolfo.christ@gmail.com> - 2016-04-15 20:57 +0200
Re: "Put" in Ruby Robert Klemme <shortcutter@googlemail.com> - 2016-04-16 01:45 +0200
Re: "Put" in Ruby Sebastian Christ <rudolfo.christ@gmail.com> - 2016-04-16 11:52 +0200
Re: "Put" in Ruby Robert Klemme <shortcutter@googlemail.com> - 2016-04-16 13:40 +0200
Re: "Put" in Ruby Robert Klemme <shortcutter@googlemail.com> - 2016-04-16 01:50 +0200
Re: "Put" in Ruby Kaz Kylheku <545-066-4921@kylheku.com> - 2016-04-16 01:39 +0000
csiph-web