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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.