June 2018
Intermediate to advanced
310 pages
6h 32m
English
In order not to confuse you, we left out one last notion of Kotlin DSL until the end of this section.
Look at this DSL:
val sql = select("name, age", { from("users", { where("age > 25") }) // Closes from }) // Closes select
It could be rewritten as:
val sql = select("name, age") { from("users") { where("age > 25") } // Closes from } // Closes select
This is common practice in Kotlin. If our function receives another function as its last argument, we can pass it out of parentheses.
This results in a much clearer DSL, but may be confusing at first.
Read now
Unlock full access