/**
 * Given two lists, find the common elements between them using list comprehension and nested loops with break and continue statements.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return List containing the common elements.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Complete the list comprehension with a condition that checks if the current element is present in both lists
    commonElements.addAll(list1.filter { it in list2 })

    return commonElements
}
/**
 * Given two lists, find the common elements between them using list comprehension and nested loops with break and continue statements.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return List containing the common elements.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Given two lists, find the common elements between them using list comprehension and nested loops with break and continue statements.
 *
 * @param list1 The first input list.
 * @param list2 The second input list.
 * @return List containing the common elements.
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Complete the list comprehension with a condition that checks if the current element is present in both lists
    commonElements.addAll(list1.filter { it in list2 })

    return commonElements
}