fun lambdaDecl(vararg parameterNames: String, block: CodeFunc): Unit
fun lambdaDecl(parameterNames: List<String>, block: CodeFunc): Unit
Render a lambda function.
The lambda is always rendered with parens around the parameters. The result looks like this:
(<parameterNames>) -> {
<block>
}
NOTE: A line break is NOT rendered after the closing curly brace.
parameterNames
- Ordered list of parameter names for the lambda.
block
- Function to render the body of the lambda.
fun lambdaDecl(vararg parameterNames: String, expression: CodeExpression): Unit
fun lambdaDecl(parameterNames: List<String>, expression: CodeExpression): Unit
Render a lambda function with a single expression and no curly braces.
The lambda is always rendered with parens around the parameters. The result looks like this:
(<parameterNames>) -> <expression>
NOTE: A line break is NOT rendered after the expression.
parameterNames
- Ordered list of parameter names for the lambda.
expression
- Expression that produces the lambda result.
fun lambdaDecl(expression: CodeExpression): Unit
Render a lambda function with a single expression and no parameters or curly braces.
The result looks like this:
() -> <expression>
NOTE: A line break is NOT rendered after the expression.