title: How to neatly print new line in Groovy?
body: <p>I was wondering if there is any neat way to write new line into the file from Groovy. I have the following script:</p>
  
  <pre><code>new File("out.txt").withWriter{ writer -&gt;
      for(line in 0..100) {
              writer &lt;&lt; "$line"
      }
  }
  </code></pre>
  
  <p>I could use <code>writer &lt;&lt; "$line\n"</code> or <code>writer.println("$line")</code>, but I was wondring if there is any way to use <code>&lt;&lt;</code> operator to append the new line for me.</p>