/**
 * This function takes two lists, list1 and list2, and returns a new list containing
 * the common elements between the two lists.
 *
 * Example:
 * list1 = [1, 2, 3, 4, 5]
 * list2 = [4, 5, 6, 7, 8]
 * getCommonElements(list1, list2) -> [4, 5]
 *
 * list1 = [10, 20, 30, 40]
 * list2 = [50, 60, 70, 80]
 * getCommonElements(list1, list2) -> []
 *
 * @param list1 The first list
 * @param list2 The second list
 * @return A list containing common elements between list1 and list2
 */
fun getCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (num in list1) {
        if (num in list2) {
            commonElements.add(num)
        }
    }
    return commonElements
}
/**
 * This function takes two lists, list1 and list2, and returns a new list containing
 * the common elements between the two lists.
 *
 * Example:
 * list1 = [1, 2, 3, 4, 5]
 * list2 = [4, 5, 6, 7, 8]
 * getCommonElements(list1, list2) -> [4, 5]
 *
 * list1 = [10, 20, 30, 40]
 * list2 = [50, 60, 70, 80]
 * getCommonElements(list1, list2) -> []
 *
 * @param list1 The first list
 * @param list2 The second list
 * @return A list containing common elements between list1 and list2
 */
fun getCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * This function takes two lists, list1 and list2, and returns a new list containing
 * the common elements between the two lists.
 *
 * Example:
 * list1 = [1, 2, 3, 4, 5]
 * list2 = [4, 5, 6, 7, 8]
 * getCommonElements(list1, list2) -> [4, 5]
 *
 * list1 = [10, 20, 30, 40]
 * list2 = [50, 60, 70, 80]
 * getCommonElements(list1, list2) -> []
 *
 * @param list1 The first list
 * @param list2 The second list
 * @return A list containing common elements between list1 and list2
 */
fun getCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (num in list1) {
        if (num in list2) {
            commonElements.add(num)
        }
    }
    return commonElements
}