Skip to content

Instantly share code, notes, and snippets.

@nbness2
Last active November 27, 2021 10:54
Show Gist options
  • Save nbness2/5af651ce6704e37ad00d82d39a83c0b8 to your computer and use it in GitHub Desktop.
Save nbness2/5af651ce6704e37ad00d82d39a83c0b8 to your computer and use it in GitHub Desktop.
val random = Random()
val randomNumber = random.nextInt()
val message = "Number is {0}"
val sign: String
if (randomNumber > 0) {
sign = "positive"
} else if (randomNumber < 0) {
sign = "negative"
} else {
sign = "zero"
}
println(MessageFormat.format(message, sign))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment