Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
S_A_SealedClasses2.kt
fun handleStateChange(newState: UIState) {
when (newState) {
is LoadingState -> println("Loading ...")
is DataState -> println("Got data: ${newState.data}")
is ErrorState -> println("Error: ${newState.error.message}")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment