Link-Title HTML What is <<-HTML in the first line and HTML in th...">

What does << - CONSTANT do?

 return <<-HTML <li> <a href = "some-link">Link-Title</a> </li> HTML 

What is <<-HTML in the first line and HTML in the last line for?

+1
source share
3 answers

This is a document. Basically, this is a multi-line string literal.

In the lines after the line with <<-HTML these are literal lines concatenated by newline characters - until a final marker is reached, which in this case is equal to HTML .

+2
source

To explicitly answer the question, this snippet returns a string:

<li>

 <a href = "some-link">Link-Title</a> 

</li>

0
source

All Articles