July 2018
Intermediate to advanced
266 pages
7h 11m
English
But, currently, we aren't actually incrementing the label, so the function will loop on label zero. That should be done right before the call to the other suspending functions:
when(state.label) { 0 -> { // Label 0 -> first execution logger.log("fetching summary of $id") sm.label = 1 fetchProfile(id, sm) return } 1 -> { // label 1 -> resuming calculateAge(profile.dateOfBirth) sm.label = 2 validateTerms(profile.country, age, sm) return } 2 -> // label 2 -> resuming and terminating UserSummary(profile, age, terms)}
Read now
Unlock full access