/**
 * This function demonstrates the intersection operation of sets using if-else statements.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 */
fun setOperations(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    if (set1 is Set<*> && set2 is Set<*>) {
        val intersection = mutableSetOf<Any>() // Create an empty set to store the intersection

        // Iterate over each element in set1
        for (element in set1) {
            // Check if the element exists in set2 as well
            if (element in set2) {
                // Add the common element to the intersection set
                intersection.add(element)
            }
        }

        return intersection
    } else {
        return setOf("Invalid input, please provide two valid sets.")
    }
}
/**
 * This function demonstrates the intersection operation of sets using if-else statements.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 */
fun setOperations(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * This function demonstrates the intersection operation of sets using if-else statements.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 */
fun setOperations(set1: Set<Any>, set2: Set<Any>): Set<Any> {

    if (set1 is Set<*> && set2 is Set<*>) {
        val intersection = mutableSetOf<Any>() // Create an empty set to store the intersection

        // Iterate over each element in set1
        for (element in set1) {
            // Check if the element exists in set2 as well
            if (element in set2) {
                // Add the common element to the intersection set
                intersection.add(element)
            }
        }

        return intersection
    } else {
        return setOf("Invalid input, please provide two valid sets.")
    }
}