July 2018
Intermediate to advanced
242 pages
8h 6m
English
In the result, we are going to get the following code printed to the console:
zxvtrpnljhfdb
In the beginning, we declared a range containing all the alphabet characters in decreasing order with the downTo() function. Then, we transformed the range a the custom progression containing every second character with the step() function. Finally, we are using the Iterable.forEach() function to iterate through the next elements of the progression and print each of them to the console.
The step() extension function is available for the IntProgression, LongProgression, and CharProgression types. Under the hood, it creates a new instance of a progression copying the properties of the original one and setting up the new step value.
Read now
Unlock full access