/**
 * This exercise tests your understanding of both the syntax of the ternary operator and accessing tuple elements.
 *
 * Given a tuple 't' and an index 'i', your task is to write a program that uses the ternary operator to access
 * the element at index 'i' in the tuple and return it as a string.
 *
 * Example:
 * ----------
 * If t = ('apple', 'banana', 'cherry', 'date') and i = 2, the expected output would be 'cherry'.
 *
 * Instructions:
 * --------------
 * Your program should perform the following steps:
 * - Implement an if-else statement using the ternary operator
 * - If the index 'i' is within the bounds of the tuple (0 <= i < t.size), return the element at index 'i' as a string
 * - Otherwise, return 'Invalid index'
 */
fun accessTuplesWithTernaryOperator(t: List<String>, i: Int): String {

    return if (i in 0 until t.size) t[i] else "Invalid index"
}
/**
 * This exercise tests your understanding of both the syntax of the ternary operator and accessing tuple elements.
 *
 * Given a tuple 't' and an index 'i', your task is to write a program that uses the ternary operator to access
 * the element at index 'i' in the tuple and return it as a string.
 *
 * Example:
 * ----------
 * If t = ('apple', 'banana', 'cherry', 'date') and i = 2, the expected output would be 'cherry'.
 *
 * Instructions:
 * --------------
 * Your program should perform the following steps:
 * - Implement an if-else statement using the ternary operator
 * - If the index 'i' is within the bounds of the tuple (0 <= i < t.size), return the element at index 'i' as a string
 * - Otherwise, return 'Invalid index'
 */
fun accessTuplesWithTernaryOperator(t: List<String>, i: Int): String {
/**
 * This exercise tests your understanding of both the syntax of the ternary operator and accessing tuple elements.
 *
 * Given a tuple 't' and an index 'i', your task is to write a program that uses the ternary operator to access
 * the element at index 'i' in the tuple and return it as a string.
 *
 * Example:
 * ----------
 * If t = ('apple', 'banana', 'cherry', 'date') and i = 2, the expected output would be 'cherry'.
 *
 * Instructions:
 * --------------
 * Your program should perform the following steps:
 * - Implement an if-else statement using the ternary operator
 * - If the index 'i' is within the bounds of the tuple (0 <= i < t.size), return the element at index 'i' as a string
 * - Otherwise, return 'Invalid index'
 */
fun accessTuplesWithTernaryOperator(t: List<String>, i: Int): String {

    return if (i in 0 until t.size) t[i] else "Invalid index"
}