/**
 * This function takes two arrays as input and finds the sum of their elements.
 * It uses a nested loop to iterate over the arrays and a break statement to exit the inner loop
 * when a certain condition is met.
 *
 * @param arr1 The first array.
 * @param arr2 The second array.
 * @return The sum of the elements from both arrays.
 *
 * Example:
 * findSumOfArrays(intArrayOf(1, 2, 3), intArrayOf(4, 5, 6)) // 21
 */
fun findSumOfArrays(arr1: IntArray, arr2: IntArray): Int {

    var totalSum = 0

    for (num1 in arr1) {
        for (num2 in arr2) {
            totalSum += num1 + num2

            if (totalSum > 50) {
                break  // Add a break statement here to optimize the loop
            }
        }
    }

    return totalSum
}
/**
 * This function takes two arrays as input and finds the sum of their elements.
 * It uses a nested loop to iterate over the arrays and a break statement to exit the inner loop
 * when a certain condition is met.
 *
 * @param arr1 The first array.
 * @param arr2 The second array.
 * @return The sum of the elements from both arrays.
 *
 * Example:
 * findSumOfArrays(intArrayOf(1, 2, 3), intArrayOf(4, 5, 6)) // 21
 */
fun findSumOfArrays(arr1: IntArray, arr2: IntArray): Int {
/**
 * This function takes two arrays as input and finds the sum of their elements.
 * It uses a nested loop to iterate over the arrays and a break statement to exit the inner loop
 * when a certain condition is met.
 *
 * @param arr1 The first array.
 * @param arr2 The second array.
 * @return The sum of the elements from both arrays.
 *
 * Example:
 * findSumOfArrays(intArrayOf(1, 2, 3), intArrayOf(4, 5, 6)) // 21
 */
fun findSumOfArrays(arr1: IntArray, arr2: IntArray): Int {

    var totalSum = 0

    for (num1 in arr1) {
        for (num2 in arr2) {
            totalSum += num1 + num2

            if (totalSum > 50) {
                break  // Add a break statement here to optimize the loop
            }
        }
    }

    return totalSum
}