Drill 17: Find the core line — Classes and data classes
Point to the line that does the main work and explain why.
What you will be able to do
- Point to the line that does the main work and explain why.
Practice task
Point to the line that does the main work and explain why.
data class User(val id: String, val name: String)
sealed class Result {
data class Ok(val value: String) : Result()
data class Error(val message: String) : Result()
}
fun render(result: Result) = when (result) {
is Result.Ok -> result.value
is Result.Error -> result.message
}Your turn
EasyWrite your answer
Point to the line that does the main work and explain why.
TEXT · starter
Your answer…Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.