I was wondering if there is any neat way to write new line into the file from Groovy. I have the following script:
new File("out.txt").withWriter{ writer ->
for(line in 0..100) {
writer << "$line"
}
}
I could use writer << "$line\n"
or writer.println("$line")
, but I was wondring if there is any way to use <<
operator to append the new line for me.