Groovy – size()

  • Post author:
  • Post category:Groovy
  • Post comments:0 Comments
Returns

Returns the number of elements in this Range.

Syntax

int size()

Parameters

None

Return Value

Returns the size of the range.

Following is an example of the usage of this method −

class Example { 
   static void main(String[] args) { 
      // Example of an Integer using def 
      def rint = 1..10; 
      println(rint.size()); 
   } 
}

When we run the above program, we will get the following result −

10

Previous Page:-Click Here

Leave a Reply