/**
 * This function calculates the dosage of a medication for a patient based on their weight and age.
 * The dosage formula is as follows:
 * - If the patient's weight is less than 50 kg, the dosage is 0.
 * - If the patient's weight is equal to or greater than 50 kg, and the patient's age is less than 10 years, the dosage is weight * 0.1.
 * - If the patient's weight is equal to or greater than 50 kg, and the patient's age is 10 years or older, the dosage is weight * 0.2.
 *
 * @param weight The weight of the patient in kilograms.
 * @param age The age of the patient in years.
 * @return The calculated dosage of the medication.
 */
fun calculateDosage(weight: Int, age: Int): Double {

    return when {
        weight < 50 || (weight >= 50 && age < 10) -> 0.0
        weight >= 50 && age >= 10 -> weight * 0.2
        else -> weight * 0.1
    }
}

// Example usage
val patient1Weight = 60
val patient1Age = 8
/**
 * This function calculates the dosage of a medication for a patient based on their weight and age.
 * The dosage formula is as follows:
 * - If the patient's weight is less than 50 kg, the dosage is 0.
 * - If the patient's weight is equal to or greater than 50 kg, and the patient's age is less than 10 years, the dosage is weight * 0.1.
 * - If the patient's weight is equal to or greater than 50 kg, and the patient's age is 10 years or older, the dosage is weight * 0.2.
 *
 * @param weight The weight of the patient in kilograms.
 * @param age The age of the patient in years.
 * @return The calculated dosage of the medication.
 */
fun calculateDosage(weight: Int, age: Int): Double {
/**
 * This function calculates the dosage of a medication for a patient based on their weight and age.
 * The dosage formula is as follows:
 * - If the patient's weight is less than 50 kg, the dosage is 0.
 * - If the patient's weight is equal to or greater than 50 kg, and the patient's age is less than 10 years, the dosage is weight * 0.1.
 * - If the patient's weight is equal to or greater than 50 kg, and the patient's age is 10 years or older, the dosage is weight * 0.2.
 *
 * @param weight The weight of the patient in kilograms.
 * @param age The age of the patient in years.
 * @return The calculated dosage of the medication.
 */
fun calculateDosage(weight: Int, age: Int): Double {

    return when {
        weight < 50 || (weight >= 50 && age < 10) -> 0.0
        weight >= 50 && age >= 10 -> weight * 0.2
        else -> weight * 0.1
    }
}

// Example usage
val patient1Weight = 60
val patient1Age = 8