Project

General

Profile

Actions

Bug #15768

closed

"and", &&, boolean issue, different ruby versions, confusing

Added by daBee (da Bee) about 5 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin15]
[ruby-core:92290]

Description

Just caught this:

# 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

>> 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0