Last active
November 27, 2017 08:59
-
-
Save sliskiCode/aeebb2d444cbd41ec0a998b5a332f72e to your computer and use it in GitHub Desktop.
6 magic sugars that can make your Kotlin codebase happier #4
This file contains hidden or 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 sugar(response: Response) = when (response) { | |
is Success -> println(response.body) | |
is Error -> println("${response.code} ${response.message}") | |
Timeout -> println(response.javaClass.simpleName) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment