/**
 * This exercise aims to test the knowledge of while loops and comparing tuples.
 * The function takes in two tuples as arguments and returns a new tuple that contains the common elements from both tuples.
 *
 * @param tuple1 First tuple
 * @param tuple2 Second tuple
 * @return Tuple containing common elements from both tuples
 */
fun commonElements(tuple1: List<Any>, tuple2: List<Any>): List<Any> {

    val common = mutableListOf<Any>() // Empty list to store common elements

    // While loop to iterate through first tuple
    var i = 0
    while (i < tuple1.size) {

        // Nested while loop to compare with second tuple
        var j = 0
        while (j < tuple2.size) {

            // Check if element of first tuple matches with element of second tuple
            if (tuple1[i] == tuple2[j]) {
                // Append the common element to the common list
                common.add(tuple1[i])
            }

            j++
        }

        i++
    }

    return common
}
/**
 * This exercise aims to test the knowledge of while loops and comparing tuples.
 * The function takes in two tuples as arguments and returns a new tuple that contains the common elements from both tuples.
 *
 * @param tuple1 First tuple
 * @param tuple2 Second tuple
 * @return Tuple containing common elements from both tuples
 */
fun commonElements(tuple1: List<Any>, tuple2: List<Any>): List<Any> {
/**
 * This exercise aims to test the knowledge of while loops and comparing tuples.
 * The function takes in two tuples as arguments and returns a new tuple that contains the common elements from both tuples.
 *
 * @param tuple1 First tuple
 * @param tuple2 Second tuple
 * @return Tuple containing common elements from both tuples
 */
fun commonElements(tuple1: List<Any>, tuple2: List<Any>): List<Any> {

    val common = mutableListOf<Any>() // Empty list to store common elements

    // While loop to iterate through first tuple
    var i = 0
    while (i < tuple1.size) {

        // Nested while loop to compare with second tuple
        var j = 0
        while (j < tuple2.size) {

            // Check if element of first tuple matches with element of second tuple
            if (tuple1[i] == tuple2[j]) {
                // Append the common element to the common list
                common.add(tuple1[i])
            }

            j++
        }

        i++
    }

    return common
}