When I google Kotlin / unused arguments, Gemini AI...
# getting-started
a
When I google Kotlin / unused arguments, Gemini AI says, confidently, “In Kotlin, you can mark an unused argument in a method or function using the underscore (
_
) character.” and even gives an example:
Copy code
fun greetUser(name: String, _: Int) {
    println("Hello, $name!")
}
… but that is incorrect, right?
v
Of course this is incorrect, what do you expect from an AI? 🙂 They are super good in giving answers that look correct, but super bad in giving answers that are correct. You can use the underscore if you for example give some lambda somewhere and do not need all parameters you have to specify.
👍 4
s
remember to look past the AI results and read the actual, not-written-by-an-LLM docs when you can: https://kotlinlang.org/docs/home.html?q=underscore&s=full