Project

General

Profile

Actions

Bug #492

closed

defined? a && defined? b

Added by shyouhei (Shyouhei Urabe) about 16 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
Backport:
[ruby-dev:35951]

Description

=begin
defined? a && defined? b がnilになります。両方定義されてるんだからnilはおかしいはずです。

irb(main):001:0> [RUBY_VERSION, RUBY_REVISION]
=> ["1.9.0", 17576]
irb(main):002:0> a = b = nil
=> nil
irb(main):003:0> defined? a && defined? b
=> nil

1.8ではdefined?(a && defined? b)と解釈されて"expression"になります

irb(main):001:0> [RUBY_VERSION, RUBY_REVISION]
=> ["1.8.7", 17572]
irb(main):002:0> a = b = nil
=> nil
irb(main):003:0> defined? a && defined? b
=> "expression"
irb(main):004:0>
=end

Actions

Also available in: Atom PDF

Like0
Like0