/**
 * This function is used by a nurse to modify the records of a patient using indexing.
 *
 * @param nurse The name of the nurse.
 * @param recordIndex The index of the record to modify.
 * @param newValue The new value to update in the patient record.
 * @return The modified patient record.
 */
fun modifyPatientRecords(nurse: String, recordIndex: Int, newValue: String): String {

    val patientRecords = listOf("Patient #1: John Doe", "Patient #2: Jane Smith", "Patient #3: Mark Johnson")

    // Check if the record index exists
    if (recordIndex >= patientRecords.size) {
        return "Invalid record index!"
    }

    // Split the patient record to extract the patient name
    val patientName = patientRecords[recordIndex].split(": ")[1]

    // Modify the patient record by replacing the name with the new value
    val modifiedRecord = patientRecords[recordIndex].replace(patientName, newValue)

    return modifiedRecord
}
/**
 * This function is used by a nurse to modify the records of a patient using indexing.
 *
 * @param nurse The name of the nurse.
 * @param recordIndex The index of the record to modify.
 * @param newValue The new value to update in the patient record.
 * @return The modified patient record.
 */
fun modifyPatientRecords(nurse: String, recordIndex: Int, newValue: String): String {
/**
 * This function is used by a nurse to modify the records of a patient using indexing.
 *
 * @param nurse The name of the nurse.
 * @param recordIndex The index of the record to modify.
 * @param newValue The new value to update in the patient record.
 * @return The modified patient record.
 */
fun modifyPatientRecords(nurse: String, recordIndex: Int, newValue: String): String {

    val patientRecords = listOf("Patient #1: John Doe", "Patient #2: Jane Smith", "Patient #3: Mark Johnson")

    // Check if the record index exists
    if (recordIndex >= patientRecords.size) {
        return "Invalid record index!"
    }

    // Split the patient record to extract the patient name
    val patientName = patientRecords[recordIndex].split(": ")[1]

    // Modify the patient record by replacing the name with the new value
    val modifiedRecord = patientRecords[recordIndex].replace(patientName, newValue)

    return modifiedRecord
}