【发布时间】:2017-10-05 23:39:07
【问题描述】:
我是 Swift 的新手。文档说:对占用多行的字符串使用三个双引号 (""")。只要它与右引号的缩进匹配,就会删除每行引用的开头的缩进。例如:
let quotation = """
Even though there's whitespace to the left,
the actual lines aren't indented.
Except for this line.
Double quotes (") can appear without being escaped.
I still have \(apples + oranges) pieces of fruit.
"""
但是,我复制了这个示例并粘贴到我的 xcode 游乐场,它显示了一个错误:
Playground execution failed: error: SwiftBasics.playground:9:19: error:
unterminated string literal
let quotation = """
我做错了什么?
【问题讨论】:
-
这是 Swift 4 和 Xcode 9 的全新版本。您使用的是什么版本的 Xcode?span>
-
可能是操场问题。它们并不总是 100% 准确地表示语言。 Typescript 的操场有一些小问题。
-
我使用的是 Xcode 8