-
-
Save hinrik/37921b9b2cb1668be6843e32ace1eb78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
@foo : String | Int32 | Bool? | |
@bar : String | Int32 | Bool? | |
def initialize(@foo, @bar) | |
end | |
def bla | |
foo = @foo | |
bar = @bar | |
if foo.is_a? String && bar.is_a? String | |
puts foo + bar | |
elsif foo.is_a? Int32 && bar.is_a? Int32 | |
puts foo + bar | |
end | |
# => undefined method '+' for Bool | |
#if foo.is_a? String && bar.is_a? String || | |
# foo.is_a? Int32 && bar.is_a? Int32 | |
# puts foo + bar | |
#end | |
end | |
end | |
foo = Foo.new(4, 5) | |
foo.bla() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment