why am I getting this?
# getting-started
b
why am I getting this?
j
You forgot
is
. You're getting this because the
when
is trying to compare expression values, it's not checking against types. So it's trying to get you to create a value of type
Resources.Success
by calling its constructor
b
ty
j
It depends on what you are doing. Your
when
branches can either check types or check values. You use
is
when you want to test whether the subject inside the
when
"is" of a certain type. If you don't use
is
, you're checking if the subject of the
when
is equal to the value in the branch.
When the expression in the branch is an
object
(probably the case of
Resource.Loading
), then an
is
check is kinda the same as a value check, because there is only one value of this type
b
wow thats a lot, thanks. I will diff have to look more into it