Build an internal DSL for a basic task management system in Kotlin. The DSL should let users define a task using a title, description, and a boolean to mark if it's complete. Also, include a function to display the details of all tasks in a format easy for people to understand. Use extension functions, higher-order functions, and the lambda with receiver feature in Kotlin to develop this DSL.
Tools for DSL
A simple task management system
Report a typo
Sample Input 1:
Learn DSL in Kotlin,Study the concept of internal and external DSLs,falseSample Output 1:
Title: Learn DSL in Kotlin
Description: Study the concept of internal and external DSLs
Status: Not CompletedWrite a program in Kotlin
class TaskBuilder {
// make your code here
}
class Task(val title: String, val description: String, val isDone: Boolean) {
// make your code here
}
fun task(block: TaskBuilder.() -> Unit): Task = TaskBuilder().apply(block).build()
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.