10 Groovy Range Examples for Working with Sequences
Half the for loops in a typical Java codebase exist just to count from one number to another. A Groovy range collapses that ceremony into two dots: 0..9 gives you a countable, iterable sequence you can loop over, slice lists with, or match in a switch. This guide covers numeric, character, and reverse ranges with examples tested on Groovy 5.0.6. “A range is the simplest way to express a sequence. If you can count it, Groovy can range it.” Last ... Read More
