/**
 * This function takes two sets as input and returns their intersection using a break statement.
 * It breaks the loop as soon as a common element is found.
 *
 * @param set1 First set of elements
 * @param set2 Second set of elements
 * @return Intersection of set1 and set2
 */
fun setIntersectionBreak(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    val intersection = mutableSetOf<Any>()  // Initialize an empty set for intersection
    
    for (elem1 in set1) {
        for (elem2 in set2) {
            if (elem1 == elem2) {  // Check if common element found
                intersection.add(elem1)  // Add element to intersection set
                break  // Break the inner loop as a common element is found
            }
        }
    }
    
    return intersection
}
/**
 * This function takes two sets as input and returns their intersection using a break statement.
 * It breaks the loop as soon as a common element is found.
 *
 * @param set1 First set of elements
 * @param set2 Second set of elements
 * @return Intersection of set1 and set2
 */
fun setIntersectionBreak(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * This function takes two sets as input and returns their intersection using a break statement.
 * It breaks the loop as soon as a common element is found.
 *
 * @param set1 First set of elements
 * @param set2 Second set of elements
 * @return Intersection of set1 and set2
 */
fun setIntersectionBreak(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    val intersection = mutableSetOf<Any>()  // Initialize an empty set for intersection
    
    for (elem1 in set1) {
        for (elem2 in set2) {
            if (elem1 == elem2) {  // Check if common element found
                intersection.add(elem1)  // Add element to intersection set
                break  // Break the inner loop as a common element is found
            }
        }
    }
    
    return intersection
}