/**
 * The function takes a list of animals and a target animal as parameters.
 * It should find the index of the target animal in the list using an infinite while loop.
 * If the target animal is not found, it should return -1.
 *
 * Example:
 * animals = listOf("lion", "tiger", "elephant", "giraffe", "rhino", "zebra")
 * targetAnimal = "giraffe"
 * findAnimalIndex(animals, targetAnimal) -> 3
 */
fun findAnimalIndex(animals: List<String>, targetAnimal: String): Int {

    var index = 0
    while (true) {
        if (animals[index] == targetAnimal) {
            return index
        }
        index++
        if (index == animals.size) {
            return -1
        }
    }
}
/**
 * The function takes a list of animals and a target animal as parameters.
 * It should find the index of the target animal in the list using an infinite while loop.
 * If the target animal is not found, it should return -1.
 *
 * Example:
 * animals = listOf("lion", "tiger", "elephant", "giraffe", "rhino", "zebra")
 * targetAnimal = "giraffe"
 * findAnimalIndex(animals, targetAnimal) -> 3
 */
fun findAnimalIndex(animals: List<String>, targetAnimal: String): Int {
/**
 * The function takes a list of animals and a target animal as parameters.
 * It should find the index of the target animal in the list using an infinite while loop.
 * If the target animal is not found, it should return -1.
 *
 * Example:
 * animals = listOf("lion", "tiger", "elephant", "giraffe", "rhino", "zebra")
 * targetAnimal = "giraffe"
 * findAnimalIndex(animals, targetAnimal) -> 3
 */
fun findAnimalIndex(animals: List<String>, targetAnimal: String): Int {

    var index = 0
    while (true) {
        if (animals[index] == targetAnimal) {
            return index
        }
        index++
        if (index == animals.size) {
            return -1
        }
    }
}