title: Is there a way to have your comments show up after you put them in an output file?
body: <p>In my Ruby file, I have multiple comments, and I am saving the output into a text file, and I was wondering if there is any way to make the comments show up in my new output file. mysql has a method that can do this which uses <code>--comments</code> in the command line. I wanted to know if Ruby has something similar to this.</p>
  
  <p>For example, I would like my name and the lab name to show up in the <code>lab1.txt</code> file:</p>
  
  <p>My Ruby code:</p>
  
  <pre><code>#My name
  #lab1.rb
  #description
  
  #part 1
  puts "hello world!"
  
  #part 2
  puts "hello world".length
  </code></pre>
  
  <p>Saving output into another file:</p>
  
  <pre><code>ruby lab1.rb &gt; lab1.txt
  </code></pre>