Skip to content

Instantly share code, notes, and snippets.

@sagarpatel288
Created June 5, 2020 02:26
Show Gist options
  • Save sagarpatel288/32b60cbbdfb4e5d73e69772cfec2cef2 to your computer and use it in GitHub Desktop.
Save sagarpatel288/32b60cbbdfb4e5d73e69772cfec2cef2 to your computer and use it in GitHub Desktop.
Get even or null
private fun getEvenOrNull(randomNumber: Int): Int? =
if (randomNumber.rem(2) == 0) randomNumber else null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment