<@U3669PPNG> commented on <@U3E25GSEP>’s file <htt...
# getting-started
u
@nkiesel commented on @robin’s file https://kotlinlang.slack.com/files/U3E25GSEP/F4A560U65/totally_overkill_version_for_arbitrary_numbers_of_closeables_.kt: (IMHO) nicer version:
Copy code
fun List<Closeable>.use(block: () -> Unit) {
    when (size) {
        0 -> return
        1 -> first().use { block() }
        else -> first().use { drop(1).use(block) }
    }
}