/**
 * This exercise aims to test the developer's understanding of loop control statements
 * and the usage of the enumerate function.
 *
 * Given a list of numbers, the developer needs to iterate through the list and output
 * only the numbers that are divisible by 3. However, if the number is divisible by 3
 * and also occurs at an even-index position, it should be skipped.
 *
 * @param numbers A list of integers.
 * @return A list containing the numbers that are divisible by 3 and don't occur at even-index positions.
 */
fun intersectionLoopControlStatementsEnumerate(numbers: List<Int>): List<Int> {

    val result = mutableListOf<Int>()

    // Iterate through the numbers using the withIndex function
    for ((index, num) in numbers.withIndex()) {

        // Skip the number if it is divisible by 3 and occurs at an even-index position
        if (num % 3 == 0 && index % 2 == 0) {
            continue
        }

        // Append the number to the result list if it is divisible by 3
        if (num % 3 == 0) {
            result.add(num)
        }
    }

    return result
}
/**
 * This exercise aims to test the developer's understanding of loop control statements
 * and the usage of the enumerate function.
 *
 * Given a list of numbers, the developer needs to iterate through the list and output
 * only the numbers that are divisible by 3. However, if the number is divisible by 3
 * and also occurs at an even-index position, it should be skipped.
 *
 * @param numbers A list of integers.
 * @return A list containing the numbers that are divisible by 3 and don't occur at even-index positions.
 */
fun intersectionLoopControlStatementsEnumerate(numbers: List<Int>): List<Int> {
/**
 * This exercise aims to test the developer's understanding of loop control statements
 * and the usage of the enumerate function.
 *
 * Given a list of numbers, the developer needs to iterate through the list and output
 * only the numbers that are divisible by 3. However, if the number is divisible by 3
 * and also occurs at an even-index position, it should be skipped.
 *
 * @param numbers A list of integers.
 * @return A list containing the numbers that are divisible by 3 and don't occur at even-index positions.
 */
fun intersectionLoopControlStatementsEnumerate(numbers: List<Int>): List<Int> {

    val result = mutableListOf<Int>()

    // Iterate through the numbers using the withIndex function
    for ((index, num) in numbers.withIndex()) {

        // Skip the number if it is divisible by 3 and occurs at an even-index position
        if (num % 3 == 0 && index % 2 == 0) {
            continue
        }

        // Append the number to the result list if it is divisible by 3
        if (num % 3 == 0) {
            result.add(num)
        }
    }

    return result
}