/**
 * In this exercise, you need to write a function that loops through two sets using a for loop, and finds
 * the common elements between them. To make it difficult, you should use nested loops to compare every
 * element of the first set with every element of the second set. When a common element is found, the
 * function should break out of the loop and return the common element.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A common element found in both sets.
 *
 * Example:
 * val set1 = setOf(1, 2, 3, 4)
 * val set2 = setOf(3, 4, 5, 6)
 * findCommonElements(set1, set2) // Output: 3
 */
fun findCommonElements(set1: Set<Int>, set2: Set<Int>): Int? {

    for (element1 in set1) {  // loop through elements of set1
        for (element2 in set2) {  // loop through elements of set2
            if (element1 == element2) {  // if a common element is found
                return element1  // return the common element
            }
        }
    }
    return null
}
/**
 * In this exercise, you need to write a function that loops through two sets using a for loop, and finds
 * the common elements between them. To make it difficult, you should use nested loops to compare every
 * element of the first set with every element of the second set. When a common element is found, the
 * function should break out of the loop and return the common element.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A common element found in both sets.
 *
 * Example:
 * val set1 = setOf(1, 2, 3, 4)
 * val set2 = setOf(3, 4, 5, 6)
 * findCommonElements(set1, set2) // Output: 3
 */
fun findCommonElements(set1: Set<Int>, set2: Set<Int>): Int? {
/**
 * In this exercise, you need to write a function that loops through two sets using a for loop, and finds
 * the common elements between them. To make it difficult, you should use nested loops to compare every
 * element of the first set with every element of the second set. When a common element is found, the
 * function should break out of the loop and return the common element.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return A common element found in both sets.
 *
 * Example:
 * val set1 = setOf(1, 2, 3, 4)
 * val set2 = setOf(3, 4, 5, 6)
 * findCommonElements(set1, set2) // Output: 3
 */
fun findCommonElements(set1: Set<Int>, set2: Set<Int>): Int? {

    for (element1 in set1) {  // loop through elements of set1
        for (element2 in set2) {  // loop through elements of set2
            if (element1 == element2) {  // if a common element is found
                return element1  // return the common element
            }
        }
    }
    return null
}