/**
 * This exercise focuses on performing operations using the 'and' operator and appending/removing elements in a list for a veterinarian.
 *
 * @param pets A list of pets under the veterinarian's care.
 */
fun vetOperations(pets: MutableList<String>) {

    // Check if the pets list is empty
    if (pets.isEmpty()) {
        println("No pets to operate on!")
    }
    
    // Check if the pets list contains dogs and cats only
    else if (pets.all { it in listOf("dog", "cat") }) {
        // Append a new pet to the list
        pets.add("hamster")
        
        // Print the updated list
        println("Updated pets: $pets")
        
        // Remove the last element from the list
        pets.removeAt(pets.size - 1)
        
        // Print the updated list
        println("Updated pets: $pets")
    }
    
    // Check if the pets list contains dogs only
    else if (pets.all { it == "dog" }) {
        // Append two new pets to the list
        pets.add("cat")
        pets.add("bird")
        
        // Print the updated list
        println("Updated pets: $pets")
        
        // Remove dogs from the list
        while ("dog" in pets) {
            pets.remove("dog")
        }
        
        // Print the updated list
        println("Updated pets: $pets")
    }
}
/**
 * This exercise focuses on performing operations using the 'and' operator and appending/removing elements in a list for a veterinarian.
 *
 * @param pets A list of pets under the veterinarian's care.
 */
fun vetOperations(pets: MutableList<String>) {
/**
 * This exercise focuses on performing operations using the 'and' operator and appending/removing elements in a list for a veterinarian.
 *
 * @param pets A list of pets under the veterinarian's care.
 */
fun vetOperations(pets: MutableList<String>) {

    // Check if the pets list is empty
    if (pets.isEmpty()) {
        println("No pets to operate on!")
    }
    
    // Check if the pets list contains dogs and cats only
    else if (pets.all { it in listOf("dog", "cat") }) {
        // Append a new pet to the list
        pets.add("hamster")
        
        // Print the updated list
        println("Updated pets: $pets")
        
        // Remove the last element from the list
        pets.removeAt(pets.size - 1)
        
        // Print the updated list
        println("Updated pets: $pets")
    }
    
    // Check if the pets list contains dogs only
    else if (pets.all { it == "dog" }) {
        // Append two new pets to the list
        pets.add("cat")
        pets.add("bird")
        
        // Print the updated list
        println("Updated pets: $pets")
        
        // Remove dogs from the list
        while ("dog" in pets) {
            pets.remove("dog")
        }
        
        // Print the updated list
        println("Updated pets: $pets")
    }
}