I’m all for Kotlin, but as others noted, your Kotlin example doesn’t do what it should, and it uses obsolete consumeEach. Consider something like using Timer instead:

Solutions Architect @Depop, author of “Hands-on Design Patterns with Kotlin” book and “Web Development with Kotlin” course

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alexey Soshin

Alexey Soshin

Solutions Architect @Depop, author of “Hands-on Design Patterns with Kotlin” book and “Web Development with Kotlin” course

More from Medium

Book Review | Fault in our Stars

Plan or No Plan