LoginSignup
0

More than 5 years have passed since last update.

a == 1 && a == 2 && a == 3がtrueになるRubyスクリプト

Last updated at Posted at 2018-01-17

stack overflowで話題になっていたんで、Rubyでも実装してみた。

a = Class.new { define_method(:==) {|_| true } }.new

puts a == 1 && a == 2 && a == 3
#=> true

元ネタ

Can (a ==1 && a== 2 && a==3) ever evaluate to true?

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0