# Comparison operator == got un issue with me

**URL:** <https://www.ruby-forum.com/t/comparison-operator-got-un-issue-with-me/263377>\
**Category:** Uncategorized\
**Created:** [October 30, 2022, 11:47am UTC](https://www.ruby-forum.com/t/comparison-operator-got-un-issue-with-me/263377 "2022-10-30T11:47:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miracle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecccb3/32.png) [@Miracle](https://www.ruby-forum.com/u/Miracle)\
**Post date:** [October 30, 2022, 11:47am UTC](https://www.ruby-forum.com/t/comparison-operator-got-un-issue-with-me/263377/1 "2022-10-30T11:47:34Z")

</div>

irb(main):189:0\> val1\>=val2.to\_i

=\> **false**

irb(main):190:0\> val1.eql? val2

=\> **false**

irb(main):191:0\> val1==val2

=\> **false**

irb(main):192:0\> val1

=\> **1**

irb(main):193:0\> val2

=\> **“2”**

irb(main):194:0\> val2= **“sde”**

=\> **“sde”**

irb(main):195:0\> val1==val2

=\> **false**

irb(main):196:1\* if val1 == val2

irb(main):197:1\* **“they are equal”**

irb(main):198:1\* else

irb(main):199:1\* **"** #{val1} is not equal to #{val2} **"**

irb(main):200:0\> end

=\> **“1 is not equal to sde”**

irb(main):201:1\* if val1 \>= val2

irb(main):202:1\* **“they are equal”**

irb(main):203:1\* else

irb(main):204:1\* **"** #{val1} is not equal to #{val2} **"**

irb(main):205:0\> end

(irb):201:in `\>=': **comparison of Integer with String failed (ArgumentError)**

irb(main):206:0\>

( the problem I got is ruby validates into false when I compare using == the val1 and val2 yet I am comparing string to a integer which I thought == is only use for same type of datatypes and it would rather also give an argument error. just. saying just confused
