/**
 * This function takes a list of tasks assigned to a social worker, the index of a specific task, and a new status.
 * It updates the status of the task at the given index in the list of tasks with the new status.
 *
 * @param tasks A list of tasks assigned to a social worker
 * @param index The index of the task to be updated
 * @param newStatus The new status to be assigned to the task at the given index
 * @return The updated list of tasks with the task at the given index having its status modified
 */
fun updateSocialWorkerTasks(tasks: MutableList<String>, index: Int, newStatus: String): MutableList<String> {

    // Check if the index is valid
    if (index >= 0 && index < tasks.size) {
        // Update the status of the task at the given index
        tasks[index] = newStatus
    } else {
        return mutableListOf("Invalid index!")
    }

    return tasks
}

// Example usage
val socialWorkerTasks = mutableListOf("Visit client A", "Call client B", "Follow-up with client C")
val indexToUpdate = 1
val newTaskStatus = "In progress"

val result = updateSocialWorkerTasks(socialWorkerTasks, indexToUpdate, newTaskStatus)
/**
 * This function takes a list of tasks assigned to a social worker, the index of a specific task, and a new status.
 * It updates the status of the task at the given index in the list of tasks with the new status.
 *
 * @param tasks A list of tasks assigned to a social worker
 * @param index The index of the task to be updated
 * @param newStatus The new status to be assigned to the task at the given index
 * @return The updated list of tasks with the task at the given index having its status modified
 */
fun updateSocialWorkerTasks(tasks: MutableList<String>, index: Int, newStatus: String): MutableList<String> {
/**
 * This function takes a list of tasks assigned to a social worker, the index of a specific task, and a new status.
 * It updates the status of the task at the given index in the list of tasks with the new status.
 *
 * @param tasks A list of tasks assigned to a social worker
 * @param index The index of the task to be updated
 * @param newStatus The new status to be assigned to the task at the given index
 * @return The updated list of tasks with the task at the given index having its status modified
 */
fun updateSocialWorkerTasks(tasks: MutableList<String>, index: Int, newStatus: String): MutableList<String> {

    // Check if the index is valid
    if (index >= 0 && index < tasks.size) {
        // Update the status of the task at the given index
        tasks[index] = newStatus
    } else {
        return mutableListOf("Invalid index!")
    }

    return tasks
}

// Example usage
val socialWorkerTasks = mutableListOf("Visit client A", "Call client B", "Follow-up with client C")
val indexToUpdate = 1
val newTaskStatus = "In progress"

val result = updateSocialWorkerTasks(socialWorkerTasks, indexToUpdate, newTaskStatus)