/**
 * This exercise requires the nurse to append new elements to a list.
 *
 * Given a list of nurse information and a list of new elements, the nurse must append each new element to the existing list.
 * The nurse should not use any built-in functions or methods except for 'add()'.
 * The nurse is not allowed to use any loops or iteration. Solutions using loops or built-in functions/methods other
 * than 'add()' will be considered incorrect.
 *
 * @param nurseList A list of nurse information.
 * @param newElements A list of new elements to append to the nurseList.
 * @return The updated nurseList with all new elements appended.
 */
fun appendNewElements(nurseList: MutableList<Any>, newElements: List<Any>): List<Any> {

    return try {
        nurseList.addAll(newElements)  // Attempting to concatenate the new elements to the existing list
        nurseList.add(1)  // Adding a placeholder element to check if the nurseList was modified successfully
        nurseList.remove(1)  // Removing the placeholder element
        nurseList  // Returning the updated list
    } catch (e: Exception) {
        listOf("Error: Unable to append new elements using only the 'add()' function.")  // Displaying error message
    }
}
/**
 * This exercise requires the nurse to append new elements to a list.
 *
 * Given a list of nurse information and a list of new elements, the nurse must append each new element to the existing list.
 * The nurse should not use any built-in functions or methods except for 'add()'.
 * The nurse is not allowed to use any loops or iteration. Solutions using loops or built-in functions/methods other
 * than 'add()' will be considered incorrect.
 *
 * @param nurseList A list of nurse information.
 * @param newElements A list of new elements to append to the nurseList.
 * @return The updated nurseList with all new elements appended.
 */
fun appendNewElements(nurseList: MutableList<Any>, newElements: List<Any>): List<Any> {
/**
 * This exercise requires the nurse to append new elements to a list.
 *
 * Given a list of nurse information and a list of new elements, the nurse must append each new element to the existing list.
 * The nurse should not use any built-in functions or methods except for 'add()'.
 * The nurse is not allowed to use any loops or iteration. Solutions using loops or built-in functions/methods other
 * than 'add()' will be considered incorrect.
 *
 * @param nurseList A list of nurse information.
 * @param newElements A list of new elements to append to the nurseList.
 * @return The updated nurseList with all new elements appended.
 */
fun appendNewElements(nurseList: MutableList<Any>, newElements: List<Any>): List<Any> {

    return try {
        nurseList.addAll(newElements)  // Attempting to concatenate the new elements to the existing list
        nurseList.add(1)  // Adding a placeholder element to check if the nurseList was modified successfully
        nurseList.remove(1)  // Removing the placeholder element
        nurseList  // Returning the updated list
    } catch (e: Exception) {
        listOf("Error: Unable to append new elements using only the 'add()' function.")  // Displaying error message
    }
}