/**
 * This function finds the intersection of two sets using a for loop and the ternary operator.
 *
 * @param set1 A set of elements.
 * @param set2 Another set of elements.
 * @return A set containing the common elements from set1 and set2.
 */
fun intersectionOfSetsWithLoopAndTernaryOperator(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Initialize an empty set to store the intersection
    val intersectionSet = mutableSetOf<Any>()

    // Iterate over the elements in set1
    for (element in set1) {
        // Check if the element is present in set2 using the ternary operator
        if (element in set2) {
            intersectionSet.add(element)
        }
    }

    // Return the intersection set
    return intersectionSet
}
/**
 * This function finds the intersection of two sets using a for loop and the ternary operator.
 *
 * @param set1 A set of elements.
 * @param set2 Another set of elements.
 * @return A set containing the common elements from set1 and set2.
 */
fun intersectionOfSetsWithLoopAndTernaryOperator(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * This function finds the intersection of two sets using a for loop and the ternary operator.
 *
 * @param set1 A set of elements.
 * @param set2 Another set of elements.
 * @return A set containing the common elements from set1 and set2.
 */
fun intersectionOfSetsWithLoopAndTernaryOperator(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    // Initialize an empty set to store the intersection
    val intersectionSet = mutableSetOf<Any>()

    // Iterate over the elements in set1
    for (element in set1) {
        // Check if the element is present in set2 using the ternary operator
        if (element in set2) {
            intersectionSet.add(element)
        }
    }

    // Return the intersection set
    return intersectionSet
}