This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

Metadata

ID: kotlin-best-practices/parens-before-trailing-lambda

Language: Kotlin

Severity: Notice

Category: Best Practices

Description

If a function has a lambda parameter and you’re passing a lambda expression, parentheses are unnecessary. Including unnecessary syntax makes the code less readable.

Non-Compliant Code Examples

val foo = "some-string".count() { it == '-' }

Compliant Code Examples

val foo = "some-string".count { it == '-' }
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Integraciones sin problemas. Prueba Datadog Code Security

PREVIEWING: guillaume.barrier/ERRORT-5095-general-doc-update