How it works...

In this example, the code is the promised rewrite of a snippet in Chapter 2, Working with Collections; Accessing collections as iterators.

The traditional range syntax (n .. m) is exclusive, meaning that 0 .. 5 will only include the numbers 0, 1, 2, 3, and 4. This is good for uses cases where you count up to a length of something, but in our case, we want to iterate over the alphabet, including Z [5]. The inclusive range syntax (n ..= m) helps us by including the last element, so that 0 ..= 5 will yield 0, 1, 2, 3, 4, and 5.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.82.154