Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dvt32/d0274a8c5447b1f99681e60fb321e38b to your computer and use it in GitHub Desktop.
Save dvt32/d0274a8c5447b1f99681e60fb321e38b to your computer and use it in GitHub Desktop.
fun awesomeMethod(a: Int, b: Int) = a + b - 101 // No need to specify return type or use "return" keyword
// This can come in handy when combining it with Kotlin's expression features
fun totallyAmazingMethod(str: String?, a: Int) =
str?.uppercase() ?:
if (a == 5) "some string" else "some other string"
// Can be helpful when using functional programming...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment