/**
 * Given two sets, find the common elements using short-circuiting with if-else and iterating through sets.
 *
 * @param setA First set.
 * @param setB Second set.
 * @return List of common elements between setA and setB.
 */
fun findCommonElements(setA: Set<Int>, setB: Set<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    
    for (elementA in setA) {
        for (elementB in setB) {
            if (elementA == elementB) {
                commonElements.add(elementA)
                break
            }
        }
    }
    
    return commonElements
}

// Exercise: Implement the findCommonElements function to return a list of common elements between setA and setB.
// The function should use short-circuiting with if-else and iterate through setA and setB.
// Do not use any built-in set operations such as 'intersect' or 'intersect'.

// Example Usage:
// println(findCommonElements(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)))
// Output: [3, 4]
/**
 * Given two sets, find the common elements using short-circuiting with if-else and iterating through sets.
 *
 * @param setA First set.
 * @param setB Second set.
 * @return List of common elements between setA and setB.
 */
fun findCommonElements(setA: Set<Int>, setB: Set<Int>): List<Int> {
/**
 * Given two sets, find the common elements using short-circuiting with if-else and iterating through sets.
 *
 * @param setA First set.
 * @param setB Second set.
 * @return List of common elements between setA and setB.
 */
fun findCommonElements(setA: Set<Int>, setB: Set<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    
    for (elementA in setA) {
        for (elementB in setB) {
            if (elementA == elementB) {
                commonElements.add(elementA)
                break
            }
        }
    }
    
    return commonElements
}

// Exercise: Implement the findCommonElements function to return a list of common elements between setA and setB.
// The function should use short-circuiting with if-else and iterate through setA and setB.
// Do not use any built-in set operations such as 'intersect' or 'intersect'.

// Example Usage:
// println(findCommonElements(setOf(1, 2, 3, 4), setOf(3, 4, 5, 6)))
// Output: [3, 4]