/**
 * Given a range of values and an array, iterate over each element within the range
 * and apply a specified modification to the element within the array.
 *
 * @param start Start of the range.
 * @param end End of the range.
 * @param array List of elements to modify.
 * @return The modified array.
 */
fun iterateAndModifyElements(start: Int, end: Int, array: MutableList<Int>): List<Int> {

    for (index in start..end) {
        if (index % 2 == 0) {
            array[index] = array[index] * 2
        } else {
            array[index] = array[index] + index
        }
    }
    return array
}

// Example usage:
/**
 * Given a range of values and an array, iterate over each element within the range
 * and apply a specified modification to the element within the array.
 *
 * @param start Start of the range.
 * @param end End of the range.
 * @param array List of elements to modify.
 * @return The modified array.
 */
fun iterateAndModifyElements(start: Int, end: Int, array: MutableList<Int>): List<Int> {
/**
 * Given a range of values and an array, iterate over each element within the range
 * and apply a specified modification to the element within the array.
 *
 * @param start Start of the range.
 * @param end End of the range.
 * @param array List of elements to modify.
 * @return The modified array.
 */
fun iterateAndModifyElements(start: Int, end: Int, array: MutableList<Int>): List<Int> {

    for (index in start..end) {
        if (index % 2 == 0) {
            array[index] = array[index] * 2
        } else {
            array[index] = array[index] + index
        }
    }
    return array
}

// Example usage: