Kotlin Builder

val childNumbers = sequence {
 yield(1)
 print("AAA")
 yieldAll(listOf(2, 3))
}
childNumbers.forEach { print(it) } // 1AAA23
val nums = childNumbers.joinToString() // AAA
print(nums) // 1, 2, 3
DevLorenzo