CHAPTER 5 SIMPLE INPUT AND OUTPUT

Strictly, input and output facilities are not part of the Groovy language. Nonetheless, real programs do communicate with their environment. To produce simple text output in Groovy, we use statements of the form:

The methods print and println are used to display the value concerned (denoted by xxx). The value may represent a String literal, a variable or expression, or an interpreted String. Method print outputs its value, and any further output appears on the same output line. Method println advances to the next output line after displaying its value.

5.1 SIMPLE OUTPUT

Example 01 demonstrates how to print ...

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.