Ruby: Embedded Ruby (ERb)

Time.now is a ruby function to display the current time. The <%= signifies this is a value being output from ruby.

<%= Time.now %>

This uses the <% (no equals sign) which doesn't output anything on the ruby lines itself, unless you tell it to in the middle of the structure.

<% 5.times do %>
I will not con Kate and Nate in class
<% end %>

The minus sign with the ending tag gets rid of unsightly line breaks and takes 10 years off your code. Free trial today!

<%= Time.now -%>
, , , , , ,

Leave a Reply

You must be logged in to post a comment.