Answer the question
In order to leave comments, you need to log in
How to implement random text output in kotlin?
I want to make a module that will display random breeds, but I don't understand how to implement it. Please tell me how to implement this
fun main {
val i1 = "Cat breeds: British, etc"
val i2 = "Dog breeds: bulldogs, etc"
val i3 = "Horse breeds: mustang, etc"
val rand = (i1..i3).random()
print(rand)
}
Answer the question
In order to leave comments, you need to log in
fun main() {
val i1 = "Породы кошек:британнцы и т.д"
val i2 = "Породы собак:бульдоги и т.д"
val i3 = "Породы лошадей:мустанг и т.д"
val random = arrayOf(i1,i2,i3)
val rand = random.nextInt(0, 2 + 1)
print(random[rand])
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question