[swift-evolution] multi-line string literals
Travis Tilley
ttilley at gmail.com
Thu Dec 10 23:45:18 CST 2015
The ruby <<- heredoc syntax, unlike the << heredoc syntax, will strip
indentation if necessary. Technically, it searches for the "least indented
line" in the whole string, and removes exactly that amount from each line.
So yes, the indentation problem -is- solved in ruby (though it might break
entirely if you have empty lines, since the least indented line has no
indentation).
On Fri, Dec 11, 2015 at 12:36 AM, Paul Cantrell <cantrell at pobox.com> wrote:
>
> In Ruby in the wild, off the top of my head and totally unscientifically,
> the most widely-used flavors I’ve seen are the heredoc with interpolation
> and terminator indentation:
>
> string = <<-EOS
> gone is music
> yet you sing
> EOS
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151211/789bbc48/attachment.html>
More information about the swift-evolution
mailing list