小编jre*_*t56的帖子

斯威夫特三个双引号

我是Swift的新手.docuentation说:对于占用多行的字符串使用三个双引号(""").每个引用行开头的缩进被删除,只要它与结束引号的缩进匹配.例如:

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.
"""
Run Code Online (Sandbox Code Playgroud)

但是,我复制了这个示例并粘贴在我的xcode playground中,它显示错误:

Playground execution failed: error: SwiftBasics.playground:9:19: error: 
unterminated string literal
let quotation = """
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么 ?

swift swift-playground

14
推荐指数
1
解决办法
4800
查看次数

标签 统计

swift ×1

swift-playground ×1