Chiggins
Chiggins

Reputation: 8397

Different tags in ERB

I'm just getting started with Ruby and Ruby on Rails, so excuse me if this is a simple question. I've noticed that in some ERB files, there is a difference to using <%= %> and <% %>, but what is the difference?

Thanks!

Upvotes: 1

Views: 446

Answers (2)

Shinya
Shinya

Reputation: 146

<%= %> in ERB equals to <?php echo ?> in PHP.

Upvotes: 0

Anubhaw
Anubhaw

Reputation: 6068

The difference is as follows:- <%= %> would execute and print the value of rails code written inside and <% %> would just execute the rails code.

Thanks, Anubhaw

Upvotes: 5

Related Questions