From e1fc7c15d6b683591858aae2a7e61e6bc960c072 Mon Sep 17 00:00:00 2001 From: Shane Date: Mon, 29 Oct 2018 17:59:52 -0400 Subject: [PATCH] change functions example (#21190) just by calling function won't print out the result and since the input name is Chinese and the output should also be chinese. --- guide/chinese/swift/functions/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guide/chinese/swift/functions/index.md b/guide/chinese/swift/functions/index.md index 5960a663ff..00f4c4fca2 100644 --- a/guide/chinese/swift/functions/index.md +++ b/guide/chinese/swift/functions/index.md @@ -4,12 +4,12 @@ localeTitle: 功能 --- ## 功能 -Swift中的函数由参数和返回类型组成。可以使用以下基本结构创建函数: \`\`\`斯威夫特 func sayHello(nameOfPerson:String) - > String { let hello =“Hello,”+ nameOfPerson +“。” 打印(你好) } +Swift中的函数由参数和返回类型组成。可以使用以下基本结构创建函数: \`\`\`斯威夫特 func sayHello(nameOfPerson:String) - > String { let hello =“Hello,”+ nameOfPerson +“。” return hello } -sayHello(nameOfPerson:“史蒂夫”) ` `` In this example, the function sayHello takes in a string name and prints out the phrase` “Hello,Steve。”。 +运行函数: print(sayHello (nameOfPerson:“史蒂夫”)) ` `` In this example, the function sayHello takes in a string name and prints out the phrase` 输出结果是: “Hello,史蒂夫。”。 ## 功能参数 函数不需要任何输入参数或返回类型。但是,在命名函数后,这需要括号。 \`\`\`斯威夫特 func helloSteve(){ 打印(“你好,史蒂夫。”) } -helloSteve()//打印出“Hello,Steve”。 \`\`\` \ No newline at end of file +helloSteve()//打印出“Hello,Steve”。 \`\`\`