/**
 * This exercise aims to test your understanding of set operations and for loops. Your task is to complete the function which should perform the intersection operation on two sets using only a for loop and return the resulting set.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 */
fun setOperationsWithForLoop(set1: Set<Any>, set2: Set<Any>): Set<Any> {

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

    // Iterate over each element in set1
    for (element in set1) {
        // Check if the element is also present in set2
        if (element in set2) {
            // Add the element to the intersectionSet
            intersectionSet.add(element)
        }
    }

    return intersectionSet
}
/**
 * This exercise aims to test your understanding of set operations and for loops. Your task is to complete the function which should perform the intersection operation on two sets using only a for loop and return the resulting set.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 */
fun setOperationsWithForLoop(set1: Set<Any>, set2: Set<Any>): Set<Any> {
/**
 * This exercise aims to test your understanding of set operations and for loops. Your task is to complete the function which should perform the intersection operation on two sets using only a for loop and return the resulting set.
 *
 * @param set1 The first set.
 * @param set2 The second set.
 * @return The intersection of set1 and set2.
 */
fun setOperationsWithForLoop(set1: Set<Any>, set2: Set<Any>): Set<Any> {

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

    // Iterate over each element in set1
    for (element in set1) {
        // Check if the element is also present in set2
        if (element in set2) {
            // Add the element to the intersectionSet
            intersectionSet.add(element)
        }
    }

    return intersectionSet
}