N
Nick Bhanji
Hello All,
I am not sure where to ask this, but someone after reading this can tell
me more.
I am trying to right a functions where I am comparing 2 arrays. Here is
an example.
a = [1,1]
b = [1,1]
in the irb, I executed a.equal? b and the result came as false.
here is the output:
irb(main):031:0> a =[1,1]
=> [1, 1]
irb(main):032:0> b =[1,1]
=> [1, 1]
irb(main):033:0> a.equal? b
=> false
irb(main):034:0>
however when I execute a.eql? b the result is true.
My questions:
1. why is equal? listed in the methods for the array
2. what is the definition of equal? in the case of array?
3. why is there another function eql? performing the actual equal test
I am using ruby version 1.8.6 for the windows
Thank you in advance.
Nick.B
I am not sure where to ask this, but someone after reading this can tell
me more.
I am trying to right a functions where I am comparing 2 arrays. Here is
an example.
a = [1,1]
b = [1,1]
in the irb, I executed a.equal? b and the result came as false.
here is the output:
irb(main):031:0> a =[1,1]
=> [1, 1]
irb(main):032:0> b =[1,1]
=> [1, 1]
irb(main):033:0> a.equal? b
=> false
irb(main):034:0>
however when I execute a.eql? b the result is true.
My questions:
1. why is equal? listed in the methods for the array
2. what is the definition of equal? in the case of array?
3. why is there another function eql? performing the actual equal test
I am using ruby version 1.8.6 for the windows
Thank you in advance.
Nick.B