In Kotlin, when is like a super-powered switch control statement. However, that's not all it can do. There's a lot of amazing logic that you can build with the when statement, one example of which is using a range with the when statement. We will take a look at that in this recipe.
Using range with the when expression
Getting ready
You need to install a preferred development environment that compiles and runs Kotlin. You can also use the command line for this purpose, for which you need Kotlin compiler installed, along with JDK. I am using the command line to compile and run my Kotlin code for this recipe.