/**
 * Given two lists, return a new list containing only the elements that are common to both lists.
 *
 * @param args1 the first list
 * @param args2 the second list
 * @return A new list with the elements common to both lists
 *
 * Instructions:
 * Your task is to complete the intersection function which takes in two lists and should return a new list containing
 * only the elements that are present in both of them. You need to make use of a continue statement inside a for loop
 * to skip iterations for elements that are not common. The final list should not contain any duplicate elements. You
 * should consider all possible edge cases and handle them appropriately.
 */
fun intersection(args1: List<Any>, args2: List<Any>): List<Any> {

    val result = mutableListOf<Any>()
    for (elem in args1) {
        if (elem in result) {
            continue
        } else {
            for (compareElem in args2) {
                if (elem == compareElem) {
                    result.add(elem)
                    break
                }
            }
        }
    }
    return result
}
/**
 * Given two lists, return a new list containing only the elements that are common to both lists.
 *
 * @param args1 the first list
 * @param args2 the second list
 * @return A new list with the elements common to both lists
 *
 * Instructions:
 * Your task is to complete the intersection function which takes in two lists and should return a new list containing
 * only the elements that are present in both of them. You need to make use of a continue statement inside a for loop
 * to skip iterations for elements that are not common. The final list should not contain any duplicate elements. You
 * should consider all possible edge cases and handle them appropriately.
 */
fun intersection(args1: List<Any>, args2: List<Any>): List<Any> {
/**
 * Given two lists, return a new list containing only the elements that are common to both lists.
 *
 * @param args1 the first list
 * @param args2 the second list
 * @return A new list with the elements common to both lists
 *
 * Instructions:
 * Your task is to complete the intersection function which takes in two lists and should return a new list containing
 * only the elements that are present in both of them. You need to make use of a continue statement inside a for loop
 * to skip iterations for elements that are not common. The final list should not contain any duplicate elements. You
 * should consider all possible edge cases and handle them appropriately.
 */
fun intersection(args1: List<Any>, args2: List<Any>): List<Any> {

    val result = mutableListOf<Any>()
    for (elem in args1) {
        if (elem in result) {
            continue
        } else {
            for (compareElem in args2) {
                if (elem == compareElem) {
                    result.add(elem)
                    break
                }
            }
        }
    }
    return result
}