What is the difference between <%, <%=, <%# and -%> in ERB in Rails?

前端 未结 7 1622
一向
一向 2020-11-21 05:33

Can some one please describe the usage of the following characters which is used in ERB file:

<%   %>
<%=  %>
<%  -%>
<%#  %>
         


        
相关标签:
7条回答
  • 2020-11-21 06:05
    • <% %> : Executes the ruby code
    • <%= %> : Prints into Erb file. Or browser
    • <% -%> : Avoids line break after expression.
    • <%# %> : ERB comment
    0 讨论(0)
提交回复
热议问题