sorry for my English, but I have a problem. I have a list of animals, and the "if else" construct should divide the animals into categories and output the correct category to the correct question.
Thank you in advance
fun main() {
val animalList = mutableListOf(
"whale",
"cat",
"dog",
"dolphin",
"parrot",
"eagle",
"fox",
"bear",
"lion",
"tiger")
println("What kind of animal would you like? Wild, predatory, home, can fly")
val question: String? = "Wild animal"
if (question == "Wild animal") {
print("Your question: ")
val question = readLine()
println("Wild animals: whale, dolphin, eagle, fox, bear, lion, tiger")
} else if (question == "Home pets") {
println("Home pets: cat, dog, parrot")
} else if (question == "Predator") {
println("Predator: eagle, fox, bear, lion, tiger")
} else if (question == "Can fly") {
println("Can fly: eagle and parrot")
} else {
println("Error")
}
}