/**
 * This exercise focuses on finding an alternative to the ternary operator and creating a range with given start and stop parameters.
 *
 * Instructions:
 * - In this exercise, the task is to create a range from 'start" to 'stop`, inclusive.
 * - However, you cannot use the built-in 'range()" function or the ternary operator (?:) to solve this problem.
 * - Your task is to come up with an alternative method to achieve this functionality.
 * - You can assume that 'start" and 'stop" will always be integers.
 *
 * Example:
 * alternativeTernaAndRange(2, 6) should return [2, 3, 4, 5, 6].
 */
fun alternativeTernaAndRange(start: Int, stop: Int): List<Int> {

    if (start > stop) {
        val result = mutableListOf<Int>()
        var current = stop
        while (current >= start) {
            result.add(current)
            current--
        }
        return result.sorted()
    } else {
        val result = mutableListOf<Int>()
        var current = start
        while (current <= stop) {
            result.add(current)
            current++
        }
        return result
    }
}
/**
 * This exercise focuses on finding an alternative to the ternary operator and creating a range with given start and stop parameters.
 *
 * Instructions:
 * - In this exercise, the task is to create a range from 'start" to 'stop`, inclusive.
 * - However, you cannot use the built-in 'range()" function or the ternary operator (?:) to solve this problem.
 * - Your task is to come up with an alternative method to achieve this functionality.
 * - You can assume that 'start" and 'stop" will always be integers.
 *
 * Example:
 * alternativeTernaAndRange(2, 6) should return [2, 3, 4, 5, 6].
 */
fun alternativeTernaAndRange(start: Int, stop: Int): List<Int> {
/**
 * This exercise focuses on finding an alternative to the ternary operator and creating a range with given start and stop parameters.
 *
 * Instructions:
 * - In this exercise, the task is to create a range from 'start" to 'stop`, inclusive.
 * - However, you cannot use the built-in 'range()" function or the ternary operator (?:) to solve this problem.
 * - Your task is to come up with an alternative method to achieve this functionality.
 * - You can assume that 'start" and 'stop" will always be integers.
 *
 * Example:
 * alternativeTernaAndRange(2, 6) should return [2, 3, 4, 5, 6].
 */
fun alternativeTernaAndRange(start: Int, stop: Int): List<Int> {

    if (start > stop) {
        val result = mutableListOf<Int>()
        var current = stop
        while (current >= start) {
            result.add(current)
            current--
        }
        return result.sorted()
    } else {
        val result = mutableListOf<Int>()
        var current = start
        while (current <= stop) {
            result.add(current)
            current++
        }
        return result
    }
}