This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun saveUserTasks(userId: Int, state: Int) { | |
when (state) { | |
0 -> { | |
val user = loadUser(userId) | |
println("user loaded") | |
// save loaded user | |
// pause execution | |
} | |
1 -> { | |
// resume execution | |
// restore saved user | |
val tasks = loadTasks(user) // ERROR: unknown user | |
println("tasks loaded") | |
// save loaded tasks | |
// pause execution | |
} | |
2 -> { | |
// resume execution | |
// restore saved tasks | |
saveTasks(tasks) // ERROR: unknown tasks | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment