/**
 * A farmer wants to keep track of the number of animals he has in his farm.
 * He has created a dictionary to store the animal names as keys and the count of each animal as values.
 * However, he wants to update the count of an animal to zero if it exceeds a certain limit.
 * Use a break statement to stop iterating the dictionary and break out of the loop to update the count.
 *
 * @param farm A dictionary containing animal names as keys and their corresponding counts as values.
 * @return The updated dictionary with animal counts possibly modified.
 */
fun breakDictionaryItems(farm: MutableMap<String, Int>): MutableMap<String, Int> {

    val limit = 5  // Maximum count before resetting to zero
    for ((animal, count) in farm.toList()) {
        if (count > limit) {
            farm[animal] = 0
            break  // Stop iterating and break out of the loop
        }
    }
    return farm
}

// Example usage
/**
 * A farmer wants to keep track of the number of animals he has in his farm.
 * He has created a dictionary to store the animal names as keys and the count of each animal as values.
 * However, he wants to update the count of an animal to zero if it exceeds a certain limit.
 * Use a break statement to stop iterating the dictionary and break out of the loop to update the count.
 *
 * @param farm A dictionary containing animal names as keys and their corresponding counts as values.
 * @return The updated dictionary with animal counts possibly modified.
 */
fun breakDictionaryItems(farm: MutableMap<String, Int>): MutableMap<String, Int> {
/**
 * A farmer wants to keep track of the number of animals he has in his farm.
 * He has created a dictionary to store the animal names as keys and the count of each animal as values.
 * However, he wants to update the count of an animal to zero if it exceeds a certain limit.
 * Use a break statement to stop iterating the dictionary and break out of the loop to update the count.
 *
 * @param farm A dictionary containing animal names as keys and their corresponding counts as values.
 * @return The updated dictionary with animal counts possibly modified.
 */
fun breakDictionaryItems(farm: MutableMap<String, Int>): MutableMap<String, Int> {

    val limit = 5  // Maximum count before resetting to zero
    for ((animal, count) in farm.toList()) {
        if (count > limit) {
            farm[animal] = 0
            break  // Stop iterating and break out of the loop
        }
    }
    return farm
}

// Example usage