Underscore

Report a typo

Sam is an intern in a big company. Yesterday he found a complicated piece of code, which uses strange underscore characters.

data class Customer(val firstName: String, val lastName: String, val age: Int, val city: String)

class CustomerFilter {
    fun showCustomers(customers: MutableList<Customer>) {
        for ((p1, _, p3) in customers) {
            if (p3 in 18..27) println(p1)
        }
    }
}

As you can see, the CustomerFilter performs some filters under the array of customers. Let's help Sam understand what is going on in the showCustomers function.

Select one option from the list
___

Create a free account to access the full topic