<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><p style="margin: 15px 0px; font-family: Helvetica, Arial; font-size: 13px;" class=""></p><blockquote type="cite" class=""><p style="margin: 15px 0px; font-family: Helvetica, Arial; font-size: 13px;" class="">Consider these two examples:</p><pre style="margin-top: 15px; margin-bottom: 15px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">let string_1 = """foo"""
let string_2 = """
foo
"""
</code></pre><p style="margin: 15px 0px; font-family: Helvetica, Arial; font-size: 13px;" class="">What’s the intuitive result you’d expect without taking all the long talk from the list into account?</p><p style="margin: 15px 0px; font-family: Helvetica, Arial; font-size: 13px;" class="">Personally, I’d say <code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">string_1 == string_2</code> is true.</p></blockquote><div class=""><br class=""></div><div class="">I think it’s reasonable to expect them to be different, actually. I might call these “single-line” and “multi-line” mode strings. The single-line mode is primarily useful for being able to include unescaped double-quotes in the string. If you’re in multi-line mode, though, it’s reasonable to be thinking about things in terms of “lines”, and having a trailing newline there seems reasonable. For example, I think it’s reasonable to expect this:</div><div class=""><font face="Menlo" class=""><br class=""></font></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Menlo" class=""><span class=""><div class="">let a = """</div></span></font><font face="Menlo" class=""><span class=""><div class="">This is line one</div></span></font><font face="Menlo" class=""><span class=""><div class="">This is line two"</div></span></font><font face="Menlo" class=""><span class=""><div class="">"""</div></span></font><font face="Menlo" class=""><span class=""><div class=""><br class=""></div></span></font><font face="Menlo" class=""><span class=""><div class="">let b = """</div></span></font><font face="Menlo" class=""><span class=""><div class="">This is line three</div></span></font><font face="Menlo" class=""><span class=""><div class="">This is line four</div></span></font><font face="Menlo" class=""><span class=""><div class="">"""</div></span></font><span class=""><br class=""></span><div class=""><font face="Menlo" class="">(a + b) == """</font></div><div class=""><font face="Menlo" class="">This is line one</font></div><div class=""><font face="Menlo" class="">This is line two</font></div><div class=""><font face="Menlo" class="">This is line three</font></div><div class=""><font face="Menlo" class="">This is line four</font></div><div class=""><font face="Menlo" class="">"""</font></div></blockquote><div class=""><br class=""></div><div class="">That seems like a reasonable model to work with multi-line strings.</div><div class=""><br class=""></div><div class="">-BJ</div></body></html>