title: "#{ }" notation vs. erb notation
body: <p>What are the differences between the notation:</p>
  
  <pre><code>"
    some text
    #{some_ruby_code}
    some text
    #{some_more_ruby_code}
    some_other_text
  "
  </code></pre>
  
  <p>and</p>
  
  <pre><code>ERB.new("
    some text
    &lt;%=some_ruby_code%&gt;
    some text
    &lt;%=some_more_ruby_code%&gt;
    some_other_text
  ").result
  </code></pre>
  
  <p>I just have a broad impression that the erb notation may be more powerful, but am not so clear. Can you compare them from various aspects, and tell which should be used in what kind of occasions? What kinds of things can be done in one notation and not in the other?</p>
  
  <p><strong>Addition 1</strong></p>
  
  <p>Most of the answers so far seem to be claiming how erb is inefficient, and shouldn't be used when <code>"#{  }"</code> can be used. Now, let's ask the other way. Why can't the <code>"#{  }"</code> notation replace erb? Wouldn't it be much faster and better?</p>
  
  <p><strong>Addition 2</strong></p>
  
  <p>Most answers below seem to be assuming that a single occurance of <code>"#{  }"</code> does not span over multiple lines, so that a chunk of code like a loop taking multiple lines cannot be embedded within. But why not? If you do so, I don't see any difference from doing it with <code>&lt;%  &gt;</code>, except that in the latter you put <code>&lt;%  &gt;</code> in every line.</p>