the code
<% # some code %>
will not cause any error, but the code
<%= # some code %>
will cause an error.
the argument is that the second statement is like
output <<
and so it is an error.
But I think since
puts "hello"
and
puts
both can run and cause no error, why not make
<%= # some code %>
not cause any error too? If we have a language / platform that will cause an error when we just comment out code, it is a big issue in the long term, since usually when we comment out something, we won't easily cause a problem and may have a hard time finding what the cause is.
for sure, we can change it to
<% # some code %>
but we lose the note there that we were going to output the content. When we uncomment the code, we don't know for sure whether it should be <% %> or <%= %> and is prone to mistake again.