Created
November 27, 2021 11:25
-
-
Save nbness2/d2c4523a5f05a54fc7be405ef999181c to your computer and use it in GitHub Desktop.
This file contains 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
val random = Random | |
val randomNumber = random.nextInt() | |
val positiveInts = 1 .. Int.MAX_VALUE | |
val negativeInts = -1 downTo Int.MIN_VALUE | |
val sign = when(randomNumber) { | |
in positiveInts -> "positive" | |
in negativeInts -> "negative" | |
else -> "zero" | |
} | |
println("Number is $sign") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment