# \[BUG:1.9\] ||= &&= doesn't return rval, but result of method

**URL:** <https://www.ruby-forum.com/t/bug-1-9-doesnt-return-rval-but-result-of-method/174431>\
**Category:** Development\
**Created:** [August 26, 2009, 6:09pm UTC](https://www.ruby-forum.com/t/bug-1-9-doesnt-return-rval-but-result-of-method/174431 "2009-08-26T18:09:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yugui](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ac91a4/32.png) [@Yugui](https://www.ruby-forum.com/u/Yugui)\
**Post date:** [August 26, 2009, 6:09pm UTC](https://www.ruby-forum.com/t/bug-1-9-doesnt-return-rval-but-result-of-method/174431/1 "2009-08-26T18:09:41Z")

</div>

Redminee$B%W%m%8%'%/%H08$KMh$F$7$^$C$?e(Bissuee$B$rE\>Aw$7$^$9!#e(B

---------- e$BE\>Aw%a%C%;!\<%8e(B ----------  
From: Joshua H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
e$BF|IUe(B: 2009/08/26 11:01  
e$B7oL\>e(B: [redmine4ruby-lang:256] [Bug #1996] ||= &&= doesn’t return  
rval,  
but result of method  
To: removed\_email\_address@domain.invalid

Bug #1996: ||= &&= doesn’t return rval, but result of method  
[http://redmine.ruby-lang.org/issues/show/1996](http://redmine.ruby-lang.org/issues/show/1996)

e$B5/I\<\<Te(B: Joshua H.  
e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal

Inconsistent behvaiour introduced in Ruby 1.9.1 with compound  
assignment operators.

> > o = Object.new  
> > =\> #Object:0x00000100975a80  
> > def o.foo=(x); x \* 2 end  
> > =\> nil  
> > def o.foo; nil end  
> > =\> nil  
> > o.foo = 1  
> > =\> 1  
> > o.foo ||= 1  
> > =\> 2  
> > RUBY\_VERSION  
> > =\> “1.9.2”  
> > RUBY\_RELEASE\_DATE  
> > =\> “2009-07-24”  
> > RUBY\_REVISION  
> > =\> 24260

In ruby 1.8

> > o = Object.new  
> > =\> #Object:0xe6c8  
> > def o.foo=(x); x \* 2 end  
> > =\> nil  
> > def o.foo; nil end  
> > =\> nil  
> > o.foo = 1  
> > =\> 1  
> > o.foo ||= 1  
> > =\> 1  
> > RUBY\_VERSION  
> > =\> “1.8.7”
