AutoCloseable
Returns an AutoCloseable instance that executes the specified closeAction upon invocation of its close() function.
expect inline fun AutoCloseable(crossinline closeAction: () -> Unit): AutoCloseable(source)
fun main() {
val resource = AutoCloseable {
println("Resource has been closed")
}
resource.use {
println("Working with resource")
}
}