In Kotlin they have a thing called a range that can be created like this:


This creates an object of type IntRange. There are some cool things you can do with an IntRange. You can use for looping:

for(n in 1..4){

And you can use it in an if:

if(x in 1..4){
println("x is OK"

Dave Ford is a developer, trainer and consultant specializing in Java, JavaScript, Kotlin and React. He is the author of Kotlin Quick Start for Java Developers , an online course published on Udemy. He offers instructor-led React and Kotlin training through his training company, Smart Soft.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.