title: File.open with block vs without
body: <p>I have a question about Block, do the two codes mean the same?</p>
  
  <p>code 1 </p>
  
  <pre><code>File::open('yozloy.txt','w') do |f|
    f &lt;&lt; 'Some contains'
  end
  </code></pre>
  
  <p>code 2</p>
  
  <pre><code>newFile = File::open('yozloy.txt','w')
  newFile &lt;&lt; 'Some contains'
  </code></pre>