Issue #15768 has been updated by Hanmac (Hans Mackowiak).


does it have something to do with different precendence?

https://ruby-doc.org/core-2.6.2/doc/syntax/precedence_rdoc.html



----------------------------------------
Bug #15768: "and", &&, boolean issue, different ruby versions, confusing
https://bugs.ruby-lang.org/issues/15768#change-77627

* Author: daBee (da Bee)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin15]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Just caught this:

``` ruby
# version 2.5.1, Mac OS

v1 = true and false                                # => IRB: true
p v1			                        		# => app.rb: true, IRB: false
v2 = true && false                                 # => IRB: false
p v2					                       # => app.rb: false, IRB: false
puts 1 > -1 && 257 < 256			# => app.rb: false, IRB: false

```

## IRB Mac OS 2.6.2

``` ruby
>> v1 = true and false
=> false
>> v2 = true && false
=> false
>> puts v1
true
=> nil
>> puts v2
false
=> nil
```

I might be missing something, but I think there's an issue here, on both versions 2.5.1 and 2.6.2.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>