/**
 * This function counts the number of occurrences of the target number in a given list.
 * However, the code is incomplete and requires the use of a break statement to be completed correctly.
 * Your task is to fill in the missing code using a break statement, allowing the function to terminate
 * the loop early when the target number is found and counting the occurrences until that point.
 *
 * @param list A list of integers
 * @param target The number to count the occurrences of in the list
 * @return The number of occurrences of the target number in the list
 */
fun countBreak(list: List<Int>, target: Int): Int {

    var totalOccurrences = 0

    for (num in list) {
        if (num == target) {
            totalOccurrences++
            break
        }
    }

    return totalOccurrences
}
/**
 * This function counts the number of occurrences of the target number in a given list.
 * However, the code is incomplete and requires the use of a break statement to be completed correctly.
 * Your task is to fill in the missing code using a break statement, allowing the function to terminate
 * the loop early when the target number is found and counting the occurrences until that point.
 *
 * @param list A list of integers
 * @param target The number to count the occurrences of in the list
 * @return The number of occurrences of the target number in the list
 */
fun countBreak(list: List<Int>, target: Int): Int {
/**
 * This function counts the number of occurrences of the target number in a given list.
 * However, the code is incomplete and requires the use of a break statement to be completed correctly.
 * Your task is to fill in the missing code using a break statement, allowing the function to terminate
 * the loop early when the target number is found and counting the occurrences until that point.
 *
 * @param list A list of integers
 * @param target The number to count the occurrences of in the list
 * @return The number of occurrences of the target number in the list
 */
fun countBreak(list: List<Int>, target: Int): Int {

    var totalOccurrences = 0

    for (num in list) {
        if (num == target) {
            totalOccurrences++
            break
        }
    }

    return totalOccurrences
}