/**
 * This exercise aims to find the maximum value among a list of floating-point numbers using the "Greater Than or Equal" operator.
 * Write a function 'findMax' that takes a list of numbers as input and returns the maximum value.
 * You should use the "Greater Than or Equal" operator (>=) to compare the numbers.
 * The function should handle edge cases such as an empty list or a list with only one number.
 * You need to write the implementation for the 'findMax' function.
 */
fun findMax(numbers: List<Double>): Double? {

    // Check if the list is empty
    if (numbers.isEmpty()) {
        return null
    }

    // Initialize the maximum value as the first element of the list
    var maxValue = numbers[0]

    // Iterate over the remaining elements of the list
    for (num in numbers.subList(1, numbers.size)) {
        // Check if the current number is greater than or equal to the maximum value
        if (num >= maxValue) {
            maxValue = num
        }
    }

    return maxValue
}
/**
 * This exercise aims to find the maximum value among a list of floating-point numbers using the "Greater Than or Equal" operator.
 * Write a function 'findMax' that takes a list of numbers as input and returns the maximum value.
 * You should use the "Greater Than or Equal" operator (>=) to compare the numbers.
 * The function should handle edge cases such as an empty list or a list with only one number.
 * You need to write the implementation for the 'findMax' function.
 */
fun findMax(numbers: List<Double>): Double? {
/**
 * This exercise aims to find the maximum value among a list of floating-point numbers using the "Greater Than or Equal" operator.
 * Write a function 'findMax' that takes a list of numbers as input and returns the maximum value.
 * You should use the "Greater Than or Equal" operator (>=) to compare the numbers.
 * The function should handle edge cases such as an empty list or a list with only one number.
 * You need to write the implementation for the 'findMax' function.
 */
fun findMax(numbers: List<Double>): Double? {

    // Check if the list is empty
    if (numbers.isEmpty()) {
        return null
    }

    // Initialize the maximum value as the first element of the list
    var maxValue = numbers[0]

    // Iterate over the remaining elements of the list
    for (num in numbers.subList(1, numbers.size)) {
        // Check if the current number is greater than or equal to the maximum value
        if (num >= maxValue) {
            maxValue = num
        }
    }

    return maxValue
}