block
fun block(before: String, hasBlockAfter: Boolean = false, hasBlockBefore: Boolean = false, lambdaParameters: String = "", lambda: CodeBuilder.() -> Unit)
Adds a construct that is followed by Kotlin block/lambda (code in curly braces).
This generates code that looks like this
<before> {
<code-generated-by-lambda>
}
Content copied to clipboard
When generating if
statements with else
or else if
clauses, set hasBlockAfter and hasBlockBefore to indicate that extra newlines and indents are not necessary, (this just makes code prettier).