about type inheritance, Can I make a type which in...
# announcements
i
about type inheritance, Can I make a type which inherite Int and String? and how?
d
Both
Int
and
String
are final, so no, you cannot inherit from them.
g
even if you could, I would still use Either
đź‘Ť 1
s
in case you’re looking for Either now. You’ll find it in the arrow lib: https://arrow-kt.io/docs/arrow/core/either/
Either<Int, String?>
is probably what you’re looking for assuming your variable is fine with being either an
Int
or a
String?
, but not both at the same time.