1. Explain lambda syntax in Kotlin including it parameter, trailing lambdas, and capturing variables.
Lambda syntax in Kotlin uses curly braces with optional parameters before arrow and body after like open curly x comma y arrow x plus y close curly, but if there's only one parameter you can omit it and use the implicit it variable. Lambdas can capture variables from their surrounding scope making them closures, and captured variables can be modified inside the lambda unlike Java's effectively final requirement. Trailing lambda syntax allows moving the last lambda parameter outside parentheses for better readability like list dot filter open paren close paren open curly it greater 5 close curly, and if the lambda is the only argument you can omit the parentheses entirely. This makes DSL-like code and builder patterns very readable in Kotlin. Understand that lambdas are compiled to function objects or inlined depending on context, and using inline functions can eliminate lambda overhead for performance-critical code. Lambda receivers like String dot open paren close paren arrow Unit enable DSL creation where this refers to the receiver type inside the lambda body.