I have multi lines in my code, I want to write certain lines in a new line, how can I do it in groovy body

33 Views Asked by At
body:"""
Hi, how are you? Yes, I am doing good. what about you. How are things going?
Nothing interesting, as usual.
"""

In the above lines, I want to print a sentence in new line in groovy (body), how can I accomplish that? Note: I am new to groovy

I tried using b tag and nothing worked.

1

There are 1 best solutions below

2
Timothy Alexis Vass On BEST ANSWER

You have done it correctly...

body:"""Hi, how are you?
Yes, I am doing good.
what about you.
How are things going?
Nothing interesting, as usual."""

You can also ask the system for the correct line separator, since it can change on different operating systems.

writer << "Line 1" + System.getProperty("line.separator") + "Line 2"