Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #2682
| From | Stefan Salewski <mail@ssalewski.de> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: puts box.dup.enlarge(4, 5) -- unexpected result |
| Date | 2011-04-12 08:12 -0500 |
| Organization | Service de news de lacave.net |
| Message-ID | <1302613914.2511.8.camel@AMD64X2.fritz.box> (permalink) |
| References | <1302611493.2511.6.camel@AMD64X2.fritz.box> <BANLkTinhvaCsF2vTHJemfajCuZS67LYGsw@mail.gmail.com> |
On Tue, 2011-04-12 at 21:55 +0900, Gunther Diemant wrote: > A method returns the last evaluated expression. In your case thats @y2 += 5 > (which has the result 8). > You could do something like this: > def enlarge(x,y) > #your code > > self > end > > so the method returns the box itself and not the result of calculationg new > coordinates. > Thanks!
Back to comp.lang.ruby | Previous | Next — Previous in thread | Find similar | Unroll thread
puts box.dup.enlarge(4, 5) -- unexpected result Stefan Salewski <mail@ssalewski.de> - 2011-04-12 07:32 -0500
Re: puts box.dup.enlarge(4, 5) -- unexpected result Gunther Diemant <g.diemant@gmx.net> - 2011-04-12 07:55 -0500
Re: puts box.dup.enlarge(4, 5) -- unexpected result Stefan Salewski <mail@ssalewski.de> - 2011-04-12 08:12 -0500
csiph-web