/**
 * This function takes in a dictionary of patient information and a patient ID.
 * It updates the patient's information by adding a new key-value pair to the dictionary.
 * The function should break the execution and return "Updated successfully!" if the patient ID does not exist in the dictionary,
 * otherwise update the information and return "Information updated!".
 *
 * @param patients A dictionary containing patient information.
 * @param patientId The ID of the patient to update.
 * @return "Updated successfully!" if the patient ID does not exist, "Information updated!" otherwise.
 */
fun updatePatientInfo(patients: MutableMap<Int, MutableMap<String, Any>>, patientId: Int): String {

    // Check if the patient ID exists in the dictionary
    if (patientId in patients) {
        // Prompt the physician to enter the new information for the patient
        print("Enter the patient's updated name: ")
        val name = readLine() ?: ""
        print("Enter the patient's updated age: ")
        val age = readLine()?.toIntOrNull() ?: 0
        print("Enter the patient's updated address: ")
        val address = readLine() ?: ""

        // Update the patient's information in the dictionary
        patients[patientId] = mutableMapOf("name" to name, "age" to age, "address" to address)
        return "Information updated!"
    }
    return "Updated successfully!"
}
/**
 * This function takes in a dictionary of patient information and a patient ID.
 * It updates the patient's information by adding a new key-value pair to the dictionary.
 * The function should break the execution and return "Updated successfully!" if the patient ID does not exist in the dictionary,
 * otherwise update the information and return "Information updated!".
 *
 * @param patients A dictionary containing patient information.
 * @param patientId The ID of the patient to update.
 * @return "Updated successfully!" if the patient ID does not exist, "Information updated!" otherwise.
 */
fun updatePatientInfo(patients: MutableMap<Int, MutableMap<String, Any>>, patientId: Int): String {
/**
 * This function takes in a dictionary of patient information and a patient ID.
 * It updates the patient's information by adding a new key-value pair to the dictionary.
 * The function should break the execution and return "Updated successfully!" if the patient ID does not exist in the dictionary,
 * otherwise update the information and return "Information updated!".
 *
 * @param patients A dictionary containing patient information.
 * @param patientId The ID of the patient to update.
 * @return "Updated successfully!" if the patient ID does not exist, "Information updated!" otherwise.
 */
fun updatePatientInfo(patients: MutableMap<Int, MutableMap<String, Any>>, patientId: Int): String {

    // Check if the patient ID exists in the dictionary
    if (patientId in patients) {
        // Prompt the physician to enter the new information for the patient
        print("Enter the patient's updated name: ")
        val name = readLine() ?: ""
        print("Enter the patient's updated age: ")
        val age = readLine()?.toIntOrNull() ?: 0
        print("Enter the patient's updated address: ")
        val address = readLine() ?: ""

        // Update the patient's information in the dictionary
        patients[patientId] = mutableMapOf("name" to name, "age" to age, "address" to address)
        return "Information updated!"
    }
    return "Updated successfully!"
}