Skip to content

Instantly share code, notes, and snippets.

@MarcinMoskala
Created March 3, 2019 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcinMoskala/e5b61c80840ad21615497be14e817f45 to your computer and use it in GitHub Desktop.
Save MarcinMoskala/e5b61c80840ad21615497be14e817f45 to your computer and use it in GitHub Desktop.
fun processPerson(person: Person?) {
val name = person?.name ?: return
val surname =
if(person.surname.isNotBlank()) person.surname
else return
//...
}
fun describeNormalNum(num: Int) {
val description = when {
num % 2 == 0 -> "Is even"
num % 2 == 1 -> "Is odd"
else -> return
}
print(description)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment