Skip to content

Instantly share code, notes, and snippets.

@darkstone
Created June 6, 2019 07:38
Show Gist options
  • Save darkstone/789997f8b9845dbfcbf149b633e21d5d to your computer and use it in GitHub Desktop.
Save darkstone/789997f8b9845dbfcbf149b633e21d5d to your computer and use it in GitHub Desktop.
Avoid using null in function
fun serveCustomer(maybeCustomer: Customer?) {
maybeCustomer ?: return // simply return
greet(customer)
customer.pickTable()
giveMenuToCustomer(customer)
forgetAboutCustomer(customer)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment