Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does dash mean in ruby on rails html scriptlet?

In the web I've seen examples both with

<% if @showIt -%>
  some html content
<% end -%>

and without

<% if @showIt %>
  some html content
<% end %>

dash. Both versions work very well. So, what difference does it make?
Thanks!

like image 660
Nikita Rybak Avatar asked Jul 14 '26 20:07

Nikita Rybak


1 Answers

It's used to avoid inserting a newline after the code.

I found a very nice explanation here.

like image 120
Ju Nogueira Avatar answered Jul 16 '26 11:07

Ju Nogueira