Created
January 9, 2017 15:33
-
-
Save mverzilli/3112e642f5c2f9eb2d171cfeb75f09e3 to your computer and use it in GitHub Desktop.
Crystal case in types vs. values
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
def get() | |
if 2 > 1 | |
{"String", {"foo" => "bar"}} | |
else | |
nil | |
end | |
end | |
x = get | |
case x; when {String, Hash}; p typeof(x); end | |
x = get | |
case x; when Tuple(String, Hash(String, String)); p typeof(x); end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment