Is this possible in crystal?
def foo(T): T forall T
if T is String
"bar"
end
end
foo(String)
Is this possible in crystal?
def foo(T): T forall T
if T is String
"bar"
end
end
foo(String)
See Type restrictions - Crystal. However, if you’re wanting to only do something when the argument is of a specific type, Methods - Crystal may be a better option?