Groovy Range Operator (..)

Range Operators

1..10 - An example of an inclusive Range
1..
‘a’..’x’ – Ranges can also consist of characters
10..1 – Ranges can also be in descending order
‘x’..’a’ – Ranges can also consist of characters and be in descending order.


sequence of values, first and last sequence


class Example {
   static void main(String[] args) {
      def range = 5..10;
      println(range);
      println(range.get(2));
   }
}
[5, 6, 7, 8, 9, 10]
7

Comments

Popular posts from this blog

தட்டு வண்டியில் காளிக்கோயில் - சிறுகதை

பிரேமாவின் பெண் குழந்தை

தீபம் பிளக்ஸ்