/**
 * Given two lists, return the intersection of the two lists.
 * Use the range function and a continue statement to solve the exercise.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return The intersection of the two lists.
 *
 * Example:
 * intersectLists(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) => [4, 5]
 * intersectLists(listOf(10, 20, 30, 40, 50), listOf(60, 70, 80, 90, 100)) => []
 */
fun intersectLists(list1: List<Int>, list2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()

    // Iterate over each element in list1
    for (num1 in list1) {
        // Check if the element is in list2
        if (num1 in list2) {
            // If the element is found, append it to intersection list
            intersection.add(num1)
            // Add a continue statement here to skip the rest of the loop body and continue to the next iteration
            continue
        }
    }

    return intersection
}
/**
 * Given two lists, return the intersection of the two lists.
 * Use the range function and a continue statement to solve the exercise.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return The intersection of the two lists.
 *
 * Example:
 * intersectLists(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) => [4, 5]
 * intersectLists(listOf(10, 20, 30, 40, 50), listOf(60, 70, 80, 90, 100)) => []
 */
fun intersectLists(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Given two lists, return the intersection of the two lists.
 * Use the range function and a continue statement to solve the exercise.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return The intersection of the two lists.
 *
 * Example:
 * intersectLists(listOf(1, 2, 3, 4, 5), listOf(4, 5, 6, 7, 8)) => [4, 5]
 * intersectLists(listOf(10, 20, 30, 40, 50), listOf(60, 70, 80, 90, 100)) => []
 */
fun intersectLists(list1: List<Int>, list2: List<Int>): List<Int> {

    val intersection = mutableListOf<Int>()

    // Iterate over each element in list1
    for (num1 in list1) {
        // Check if the element is in list2
        if (num1 in list2) {
            // If the element is found, append it to intersection list
            intersection.add(num1)
            // Add a continue statement here to skip the rest of the loop body and continue to the next iteration
            continue
        }
    }

    return intersection
}