/**
 * This exercise aims to test the understanding of tuple concatenation and the OR operator.
 * The function takes in two tuples, tup1 and tup2, and concatenates them together. If an element in tup1
 * is equal to an element in tup2, the result will contain the element only once. Otherwise, both elements will be included.
 * The function returns the concatenated tuple.
 */
fun concatenateOrOperator(tup1: List<Any>, tup2: List<Any>): List<Any> {

    val result = mutableListOf<Any>()
    
    for (elem1 in tup1) {
        if (elem1 in tup2) {
            result.add(elem1)
        } else {
            result.add(elem1)
            result.add(elem1)
        }
    }
    
    for (elem2 in tup2) {
        if (elem2 !in tup1) {
            result.add(elem2)
        }
    }
    
    return result
}
/**
 * This exercise aims to test the understanding of tuple concatenation and the OR operator.
 * The function takes in two tuples, tup1 and tup2, and concatenates them together. If an element in tup1
 * is equal to an element in tup2, the result will contain the element only once. Otherwise, both elements will be included.
 * The function returns the concatenated tuple.
 */
fun concatenateOrOperator(tup1: List<Any>, tup2: List<Any>): List<Any> {
/**
 * This exercise aims to test the understanding of tuple concatenation and the OR operator.
 * The function takes in two tuples, tup1 and tup2, and concatenates them together. If an element in tup1
 * is equal to an element in tup2, the result will contain the element only once. Otherwise, both elements will be included.
 * The function returns the concatenated tuple.
 */
fun concatenateOrOperator(tup1: List<Any>, tup2: List<Any>): List<Any> {

    val result = mutableListOf<Any>()
    
    for (elem1 in tup1) {
        if (elem1 in tup2) {
            result.add(elem1)
        } else {
            result.add(elem1)
            result.add(elem1)
        }
    }
    
    for (elem2 in tup2) {
        if (elem2 !in tup1) {
            result.add(elem2)
        }
    }
    
    return result
}