return <<-HTML
<li>
<a href = "some-link">Link-Title</a>
</li>
HTML
What are <<-HTML on the first line and HTML on the last line for?
cam
It's a heredoc.
That's a here document. Basically, it's a multi-line string literal.
On lines after the line with the <<-HTML
, those are literal strings concatenated by newlines-- until the end marker is reached, which in this case is HTML
.
To explicitly answer the question, this snippet returns the string:
<li>
<a href = "some-link">Link-Title</a>
</li>
来源:https://stackoverflow.com/questions/4608902/what-does-constant-do