/**
 * Given a list of songs and a new song, concatenate the new song to the list and update the original list.
 *
 * @param songs List of songs (strings).
 * @param newSong New song to be added to the list.
 * @return Updated list of songs.
 * @throws IllegalArgumentException If songs is not a list or newSong is not a string.
 *
 * Example:
 * concatenateUpdate(listOf("Song1", "Song2"), "Song3") // Output: ["Song1", "Song2", "Song3"]
 * concatenateUpdate(emptyList(), "Song1") // Output: ["Song1"]
 */
fun concatenateUpdate(songs: MutableList<String>, newSong: String): List<String> {

    if (songs !is MutableList) {
        throw IllegalArgumentException("The 'songs' parameter must be a list.")
    }
    if (newSong !is String) {
        throw IllegalArgumentException("The 'newSong' parameter must be a string.")
    }

    songs.add(newSong)
    return songs
}
/**
 * Given a list of songs and a new song, concatenate the new song to the list and update the original list.
 *
 * @param songs List of songs (strings).
 * @param newSong New song to be added to the list.
 * @return Updated list of songs.
 * @throws IllegalArgumentException If songs is not a list or newSong is not a string.
 *
 * Example:
 * concatenateUpdate(listOf("Song1", "Song2"), "Song3") // Output: ["Song1", "Song2", "Song3"]
 * concatenateUpdate(emptyList(), "Song1") // Output: ["Song1"]
 */
fun concatenateUpdate(songs: MutableList<String>, newSong: String): List<String> {
/**
 * Given a list of songs and a new song, concatenate the new song to the list and update the original list.
 *
 * @param songs List of songs (strings).
 * @param newSong New song to be added to the list.
 * @return Updated list of songs.
 * @throws IllegalArgumentException If songs is not a list or newSong is not a string.
 *
 * Example:
 * concatenateUpdate(listOf("Song1", "Song2"), "Song3") // Output: ["Song1", "Song2", "Song3"]
 * concatenateUpdate(emptyList(), "Song1") // Output: ["Song1"]
 */
fun concatenateUpdate(songs: MutableList<String>, newSong: String): List<String> {

    if (songs !is MutableList) {
        throw IllegalArgumentException("The 'songs' parameter must be a list.")
    }
    if (newSong !is String) {
        throw IllegalArgumentException("The 'newSong' parameter must be a string.")
    }

    songs.add(newSong)
    return songs
}