/**
 * The function slices a tuple and returns the values in reverse order within a while loop.
 *
 * @param data The tuple to be sliced.
 * @param index The index at which to start the slicing.
 * @return A new tuple with the sliced values in reverse order.
 *
 * Example:
 * sliceTuplesWhileLoop(listOf(1, 2, 3, 4, 5), 2) // Output: listOf(5, 4)
 */
fun sliceTuplesWhileLoop(data: List<Int>, index: Int): List<Int> {

    var sliced = emptyList<Int>()
    var i = index

    while (i < data.size) {
        sliced = listOf(data[i]) + sliced
        i++
    }

    return sliced
}
/**
 * The function slices a tuple and returns the values in reverse order within a while loop.
 *
 * @param data The tuple to be sliced.
 * @param index The index at which to start the slicing.
 * @return A new tuple with the sliced values in reverse order.
 *
 * Example:
 * sliceTuplesWhileLoop(listOf(1, 2, 3, 4, 5), 2) // Output: listOf(5, 4)
 */
fun sliceTuplesWhileLoop(data: List<Int>, index: Int): List<Int> {
/**
 * The function slices a tuple and returns the values in reverse order within a while loop.
 *
 * @param data The tuple to be sliced.
 * @param index The index at which to start the slicing.
 * @return A new tuple with the sliced values in reverse order.
 *
 * Example:
 * sliceTuplesWhileLoop(listOf(1, 2, 3, 4, 5), 2) // Output: listOf(5, 4)
 */
fun sliceTuplesWhileLoop(data: List<Int>, index: Int): List<Int> {

    var sliced = emptyList<Int>()
    var i = index

    while (i < data.size) {
        sliced = listOf(data[i]) + sliced
        i++
    }

    return sliced
}