Anyone know the difference between `val a: String?...
# android
t
Anyone know the difference between
val a: String? = b as String?
and
val a: String? = b as? String
e
b as? String
returns null if it cannot be cast to
String
, if I'm not mistaken.
­čĹŹ 1
e
@Edgars right, the former will throw exception if
b
is not
String?
i
b as String = unsafe operator. It can be null.