Skip to content

Instantly share code, notes, and snippets.

@chaxiu
Created October 18, 2020 12:04
Show Gist options
  • Save chaxiu/d8f6a586a263ac11320746bdb1aeed28 to your computer and use it in GitHub Desktop.
Save chaxiu/d8f6a586a263ac11320746bdb1aeed28 to your computer and use it in GitHub Desktop.
// "fake" suspending function
// Although it has suspend modifier,
// it will not really suspend when executed,
// because there is no other suspending in its body
// ↓
suspend fun noSuspendFriendList(user: String): String{
return "Tom, Jack"
}
suspend fun testNoSuspend() {
log("start")
val user = getUserInfo()
log(user)
// changes
// ↓
val friendList = noSuspendFriendList(user)
log(friendList)
val feedList = getFeedList(friendList)
log(feedList)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment