February 2018
Intermediate to advanced
356 pages
9h 10m
English
Sometimes we need to interact over values but with the arbitrary steps, not one by one, for example. Then we can use the step instruction. Let's practice:
for (i in 1..6 step 2) { print(i)}
Here, we will see the following output: 135, because the interaction will start on the 1 value and will be increased by two points.
Awesome. The Kotlin ranges can add more readability to our source code and help to increase the quality of code as well.