Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Crystal case in types vs. values
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