class TestClass
getter :value
def initialize(str : String)
initialize(str.to_i)
end
def initialize(@value : Int32)
end
def initialize(mixedA : Int32 | String, mixedB : Int32 | String)
initialize(initialize(mixedA) + initialize(mixedB))
end
end
icr(0.19.4) > a = TestClass.new(123)
#<TestClass:0x10432bfd0>
=> #<TestClass:0x10432bf80 @value=123>
icr(0.19.4) > b = TestClass.new("123")
#<TestClass:0x10c929fd0>
=> #<TestClass:0x10c929f70 @value=123>
icr(0.19.4) > a.value == b.value
#<TestClass:0x1066fdfd0>
=> true
icr(0.19.4) >
Crystal for Rubyists