/**
 * This function takes in two lists and returns a new list containing the common elements between them.
 *
 * @param list1 First list containing elements of any data type
 * @param list2 Second list containing elements of any data type
 * @return List containing the common elements of list1 and list2
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(2, 4, 6, 8)) -> listOf(2, 4)
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate through each element in list1
    for (element in list1) {
        // Check if the element is also present in list2
        if (element in list2) {
            // Add the element to the commonElements list
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * This function takes in two lists and returns a new list containing the common elements between them.
 *
 * @param list1 First list containing elements of any data type
 * @param list2 Second list containing elements of any data type
 * @return List containing the common elements of list1 and list2
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(2, 4, 6, 8)) -> listOf(2, 4)
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * This function takes in two lists and returns a new list containing the common elements between them.
 *
 * @param list1 First list containing elements of any data type
 * @param list2 Second list containing elements of any data type
 * @return List containing the common elements of list1 and list2
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(2, 4, 6, 8)) -> listOf(2, 4)
 */
fun findCommonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val commonElements = mutableListOf<Any>()

    // Iterate through each element in list1
    for (element in list1) {
        // Check if the element is also present in list2
        if (element in list2) {
            // Add the element to the commonElements list
            commonElements.add(element)
        }
    }

    return commonElements
}