/**
 * Given two lists of numbers, find the intersection (common elements)
 * and assign these common elements to a new list.
 *
 * @param numbers1 The first list of numbers.
 * @param numbers2 The second list of numbers.
 * @return A new list containing the common elements from both lists.
 */
fun intersectionLoopAssignment(numbers1: List<Int>, numbers2: List<Int>): List<Int> {

    // Create an empty list to store the common elements
    val commonElements = mutableListOf<Int>()

    // Loop through each element in the first list
    for (num1 in numbers1) {
        // Loop through each element in the second list
        for (num2 in numbers2) {
            // Check if the current element from the first list is equal to the current element from the second list
            if (num1 == num2) {
                // Assign the common element to the new list
                commonElements.add(num1)
                break  // Exit the inner loop since we found a common element
            }
        }
    }

    return commonElements
}
/**
 * Given two lists of numbers, find the intersection (common elements)
 * and assign these common elements to a new list.
 *
 * @param numbers1 The first list of numbers.
 * @param numbers2 The second list of numbers.
 * @return A new list containing the common elements from both lists.
 */
fun intersectionLoopAssignment(numbers1: List<Int>, numbers2: List<Int>): List<Int> {
/**
 * Given two lists of numbers, find the intersection (common elements)
 * and assign these common elements to a new list.
 *
 * @param numbers1 The first list of numbers.
 * @param numbers2 The second list of numbers.
 * @return A new list containing the common elements from both lists.
 */
fun intersectionLoopAssignment(numbers1: List<Int>, numbers2: List<Int>): List<Int> {

    // Create an empty list to store the common elements
    val commonElements = mutableListOf<Int>()

    // Loop through each element in the first list
    for (num1 in numbers1) {
        // Loop through each element in the second list
        for (num2 in numbers2) {
            // Check if the current element from the first list is equal to the current element from the second list
            if (num1 == num2) {
                // Assign the common element to the new list
                commonElements.add(num1)
                break  // Exit the inner loop since we found a common element
            }
        }
    }

    return commonElements
}