/**
 * Given a list and an index, this function checks if the index is within the range of the list, and returns the element at that index.
 * If the index is out of range, it returns null.
 *
 * @param listVar the list to check the index against
 * @param index the index to access the element
 * @return The element at the specified index if it is within range, otherwise null.
 */
fun checkList(listVar: List<Any>, index: Int): Any? {

    return if (index < 0 || index >= listVar.size) {
        null
    } else {
        listVar[index]
    }
}
/**
 * Given a list and an index, this function checks if the index is within the range of the list, and returns the element at that index.
 * If the index is out of range, it returns null.
 *
 * @param listVar the list to check the index against
 * @param index the index to access the element
 * @return The element at the specified index if it is within range, otherwise null.
 */
fun checkList(listVar: List<Any>, index: Int): Any? {
/**
 * Given a list and an index, this function checks if the index is within the range of the list, and returns the element at that index.
 * If the index is out of range, it returns null.
 *
 * @param listVar the list to check the index against
 * @param index the index to access the element
 * @return The element at the specified index if it is within range, otherwise null.
 */
fun checkList(listVar: List<Any>, index: Int): Any? {

    return if (index < 0 || index >= listVar.size) {
        null
    } else {
        listVar[index]
    }
}