Can some one please describe the usage of the following characters which is used in ERB file:
<% %>
<%= %>
<% -%>
<%# %>
These are use in ruby on rails :-
<% %> :-
The <% %> tags are used to execute Ruby code that does not return anything, such as conditions, loops or blocks. Eg :-
Names of all the people
<% @people.each do |person| %>
Name: <%= person.name %>
<% end %>
<%= %> :-
use to display the content .
Name: <%= person.name %>
<% -%>:-
Rails extends ERB, so that you can suppress the newline simply by adding a trailing hyphen to tags in Rails templates
<%# %>:-
comment out the code
<%# WRONG %>
Hi, Mr. <% puts "Frodo" %>