CHAPTER 7 METHODS

A method is a name given to a segment of code that can be executed or called one or more times in a program. Methods may also be given parameters that act as input values to the method call. Each method call may use different actual parameters that determine the effect of the method when it is executed.

Methods in Groovy partition large programs into smaller manageable units, thus simplifying the programming task. Each method is responsible for a particular functionality required in the application. One method can call or execute any other method. Thus, a task represented by one method can be partitioned into subtasks realized by other submethods. Further, methods developed in one program may be incorporated into other programs, ...

Get Groovy Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.