/**
 * This exercise focuses on appending new elements to a list using for loops.
 *
 * The function takes two lists as arguments, list1 and list2, and appends the elements from list2 to list1.
 * The function then returns the modified list1.
 *
 * Your task is to complete the code by using a for loop to iterate over list2, appending each element to list1.
 *
 * Example:
 * ----------
 * list1 = [1, 2, 3]
 * list2 = [4, 5, 6]
 * appendElements(list1, list2) should modify list1 to [1, 2, 3, 4, 5, 6] and return it.
 *
 * Note:
 * ----------
 * - The input lists can contain any type of elements.
 * - You should not use any built-in Kotlin methods like plusAssign() to solve this exercise.
 */
fun appendElements(list1: MutableList<Any>, list2: List<Any>): List<Any> {

    // Iterate over each element in list2
    for (element in list2) {
        list1.add(element)
    }
    return list1
}
/**
 * This exercise focuses on appending new elements to a list using for loops.
 *
 * The function takes two lists as arguments, list1 and list2, and appends the elements from list2 to list1.
 * The function then returns the modified list1.
 *
 * Your task is to complete the code by using a for loop to iterate over list2, appending each element to list1.
 *
 * Example:
 * ----------
 * list1 = [1, 2, 3]
 * list2 = [4, 5, 6]
 * appendElements(list1, list2) should modify list1 to [1, 2, 3, 4, 5, 6] and return it.
 *
 * Note:
 * ----------
 * - The input lists can contain any type of elements.
 * - You should not use any built-in Kotlin methods like plusAssign() to solve this exercise.
 */
fun appendElements(list1: MutableList<Any>, list2: List<Any>): List<Any> {
/**
 * This exercise focuses on appending new elements to a list using for loops.
 *
 * The function takes two lists as arguments, list1 and list2, and appends the elements from list2 to list1.
 * The function then returns the modified list1.
 *
 * Your task is to complete the code by using a for loop to iterate over list2, appending each element to list1.
 *
 * Example:
 * ----------
 * list1 = [1, 2, 3]
 * list2 = [4, 5, 6]
 * appendElements(list1, list2) should modify list1 to [1, 2, 3, 4, 5, 6] and return it.
 *
 * Note:
 * ----------
 * - The input lists can contain any type of elements.
 * - You should not use any built-in Kotlin methods like plusAssign() to solve this exercise.
 */
fun appendElements(list1: MutableList<Any>, list2: List<Any>): List<Any> {

    // Iterate over each element in list2
    for (element in list2) {
        list1.add(element)
    }
    return list1
}