/**
 * This function takes a list of elements and a condition as arguments, and returns a set of elements that satisfy
 * the given condition. If a particular element satisfies the condition, it is included in the resulting set,
 * otherwise it is excluded. A ternary operator is not used in this function to emphasize alternative approaches.
 *
 * @param elements A list of elements.
 * @param condition A condition which takes an element and returns true or false.
 * @return A set of elements that satisfy the given condition.
 */
fun createSetWithCondition(elements: List<Int>, condition: (Int) -> Boolean): Set<Int> {

    // Create an empty set to store the elements that satisfy the condition
    val resultSet = mutableSetOf<Int>()

    // Iterate over each element in the list
    for (element in elements) {
        // Check if the element satisfies the condition
        if (condition(element)) {
            resultSet.add(element)
        }
    }

    return resultSet
}

// Example usage of the function
val numbers = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

// Create a set of even numbers using a lambda function
val evenNumbers = createSetWithCondition(numbers) { it % 2 == 0 }
/**
 * This function takes a list of elements and a condition as arguments, and returns a set of elements that satisfy
 * the given condition. If a particular element satisfies the condition, it is included in the resulting set,
 * otherwise it is excluded. A ternary operator is not used in this function to emphasize alternative approaches.
 *
 * @param elements A list of elements.
 * @param condition A condition which takes an element and returns true or false.
 * @return A set of elements that satisfy the given condition.
 */
fun createSetWithCondition(elements: List<Int>, condition: (Int) -> Boolean): Set<Int> {
/**
 * This function takes a list of elements and a condition as arguments, and returns a set of elements that satisfy
 * the given condition. If a particular element satisfies the condition, it is included in the resulting set,
 * otherwise it is excluded. A ternary operator is not used in this function to emphasize alternative approaches.
 *
 * @param elements A list of elements.
 * @param condition A condition which takes an element and returns true or false.
 * @return A set of elements that satisfy the given condition.
 */
fun createSetWithCondition(elements: List<Int>, condition: (Int) -> Boolean): Set<Int> {

    // Create an empty set to store the elements that satisfy the condition
    val resultSet = mutableSetOf<Int>()

    // Iterate over each element in the list
    for (element in elements) {
        // Check if the element satisfies the condition
        if (condition(element)) {
            resultSet.add(element)
        }
    }

    return resultSet
}

// Example usage of the function
val numbers = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)

// Create a set of even numbers using a lambda function
val evenNumbers = createSetWithCondition(numbers) { it % 2 == 0 }