[ruby-core:92302] [Ruby trunk Bug#15768] "and", &&, boolean issue, different ruby versions, confusing

From: duerst@...
Date: 2019-04-16 07:33:54 UTC
List: ruby-core #92302
Issue #15768 has been updated by duerst (Martin Dst).

Status changed from Open to Closed

This is per spec as explained, so I'm closing it.

If you should want to change it, please create a feature request, and explain in detail what the change would do and how it would be backwards compatible.

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

* Author: daBee (da Bee)
* Status: Closed
* 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>

In This Thread

Prev Next