From 716a0d08eb9f0d642913d1c58316eed9f317ed20 Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 13:57:00 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 虽然英文原文是“its Boolean isEmpty property”,但是按照翻译的语义,应该是指的具体返回值的类型Bool --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index b0c123f3..86efb39d 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -68,7 +68,7 @@ var anotherEmptyString = String() // 初始化方法 // 两个字符串均为空并等价。 ``` -您可以通过检查其`Boolean`类型的`isEmpty`属性来判断该字符串是否为空: +您可以通过检查其`Bool`类型的`isEmpty`属性来判断该字符串是否为空: ```swift if emptyString.isEmpty { From 86a67b75457977b59738d9844c33d8ecc2b9e6fd Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 15:16:28 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REGIONAL应该翻译为地域性 --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index 86efb39d..90e0d86d 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -269,7 +269,7 @@ let enclosedEAcute: Character = "\u{E9}\u{20DD}" // enclosedEAcute 是 é⃝ ``` -局部的指示符号的 Unicode 标量可以组合成一个单一的`Character`值,例如`REGIONAL INDICATOR SYMBOL LETTER U`(`U+1F1FA`)和`REGIONAL INDICATOR SYMBOL LETTER S`(`U+1F1F8`): +地域性指示符号的 Unicode 标量可以组合成一个单一的`Character`值,例如`REGIONAL INDICATOR SYMBOL LETTER U`(`U+1F1FA`)和`REGIONAL INDICATOR SYMBOL LETTER S`(`U+1F1F8`): ```swift From 781c484681df877af58163df5cc5b22cd588869c Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 15:21:34 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “You access and modify a string through its methods and properties” 翻译不准确,并且少了一个字“通” --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index 90e0d86d..cc3c8327 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -312,7 +312,7 @@ print("the number of characters in \(word) is \(word.characters.count)") ## 访问和修改字符串 (Accessing and Modifying a String) -你可以通字符串的属性和方法来访问和读取它,当然也可以用下标语法完成。 +你可以通过字符串的属性和方法来访问和修改它,当然也可以用下标语法完成。 ### 字符串索引 (String Indices) From e863958b5be360f717e0e8eb799f2f972920fe83 Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 15:39:25 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E5=86=85=E5=AE=B9=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit terminator不应该有空格,否则每个单词之间会有两个空格,英文版也没有空格 --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index cc3c8327..c145c43a 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -351,7 +351,7 @@ greeting.endIndex.successor() // error ```swift for index in greeting.characters.indices { - print("\(greeting[index]) ", terminator: " ") + print("\(greeting[index]) ", terminator: "") } // 打印输出 "G u t e n T a g !" ``` From a6cd183abaa044e86ed414d85822f7f376cab58d Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 15:47:12 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E6=AD=A7=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用地域更易理解,不然容易与之前的索引混淆,并且加上英文原文 --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index c145c43a..61e1f50b 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -440,7 +440,7 @@ if latinCapitalLetterA != cyrillicCapitalLetterA { ``` > 注意: -> 在 Swift 中,字符串和字符并不区分区域。 +> 在 Swift 中,字符串和字符并不区分地域(not locale-sensitive)。 From b15859e7d1c3a8c0f734462a76626973a12c31b1 Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 15:54:02 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 定义类名次,加上``引用和英文描述 --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index 61e1f50b..4be6133f 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -502,7 +502,7 @@ print("\(mansionCount) mansion scenes; \(cellCount) cell scenes") ## 字符串的 Unicode 表示形式(Unicode Representations of Strings) -当一个 Unicode 字符串被写进文本文件或者其他储存时,字符串中的 Unicode 标量会用 Unicode 定义的几种编码格式编码。每一个字符串中的小块编码都被称为代码单元。这些包括 UTF-8 编码格式(编码字符串为8位的代码单元), UTF-16 编码格式(编码字符串位16位的代码单元),以及 UTF-32 编码格式(编码字符串32位的代码单元)。 +当一个 Unicode 字符串被写进文本文件或者其他储存时,字符串中的 Unicode 标量会用 Unicode 定义的几种`编码格式`(encoding forms))))编码。每一个字符串中的小块编码都被称`代码单元`(code units)。这些包括 UTF-8 编码格式(编码字符串为8位的代码单元), UTF-16 编码格式(编码字符串位16位的代码单元),以及 UTF-32 编码格式(编码字符串32位的代码单元)。 Swift 提供了几种不同的方式来访问字符串的 Unicode 表示形式。 您可以利用`for-in`来对字符串进行遍历,从而以 Unicode 可扩展的字符群集的方式访问每一个`Character`值。 From ba6f7a207eac27b5cffc3f6a7d24cd579892ba6f Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 15:55:31 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9A=E5=88=9A?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多了几个括号 --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index 4be6133f..2fd21863 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -502,7 +502,7 @@ print("\(mansionCount) mansion scenes; \(cellCount) cell scenes") ## 字符串的 Unicode 表示形式(Unicode Representations of Strings) -当一个 Unicode 字符串被写进文本文件或者其他储存时,字符串中的 Unicode 标量会用 Unicode 定义的几种`编码格式`(encoding forms))))编码。每一个字符串中的小块编码都被称`代码单元`(code units)。这些包括 UTF-8 编码格式(编码字符串为8位的代码单元), UTF-16 编码格式(编码字符串位16位的代码单元),以及 UTF-32 编码格式(编码字符串32位的代码单元)。 +当一个 Unicode 字符串被写进文本文件或者其他储存时,字符串中的 Unicode 标量会用 Unicode 定义的几种`编码格式`(encoding forms)编码。每一个字符串中的小块编码都被称`代码单元`(code units)。这些包括 UTF-8 编码格式(编码字符串为8位的代码单元), UTF-16 编码格式(编码字符串位16位的代码单元),以及 UTF-32 编码格式(编码字符串32位的代码单元)。 Swift 提供了几种不同的方式来访问字符串的 Unicode 表示形式。 您可以利用`for-in`来对字符串进行遍历,从而以 Unicode 可扩展的字符群集的方式访问每一个`Character`值。 From 88ecb81a47a067e9c99114305507e26a42b6e075 Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 16:00:13 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 小狗字符错显示成了?乱码,开头几个字符用逗号隔开可读性更强,就像英文版一样 --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index 2fd21863..279af47a 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -514,7 +514,7 @@ Swift 提供了几种不同的方式来访问字符串的 Unicode 表示形式 * UTF-16 代码单元集合 (利用字符串的`utf16`属性进行访问) * 21位的 Unicode 标量值集合,也就是字符串的 UTF-32 编码格式 (利用字符串的`unicodeScalars`属性进行访问) -下面由`D``o``g``‼`(`DOUBLE EXCLAMATION MARK`, Unicode 标量 `U+203C`)和`�`(`DOG FACE`,Unicode 标量为`U+1F436`)组成的字符串中的每一个字符代表着一种不同的表示: +下面由`D`,`o`,`g`,`‼`(`DOUBLE EXCLAMATION MARK`, Unicode 标量 `U+203C`)和`🐶`(`DOG FACE`,Unicode 标量为`U+1F436`)组成的字符串中的每一个字符代表着一种不同的表示: ```swift let dogString = "Dog‼🐶" From 1472d14d6310132361c81b1bf7df7c40ef47f565 Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 16:07:36 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E4=B8=8D=E5=87=86=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “ which is a collection of values of type UnicodeScalar.” 这里描述不准确 --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index 279af47a..283e810d 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -633,7 +633,7 @@ print("") ### Unicode 标量表示 (Unicode Scalars Representation) 您可以通过遍历`String`值的`unicodeScalars`属性来访问它的 Unicode 标量表示。 -其为`UnicodeScalarView`类型的属性,`UnicodeScalarView`是`UnicodeScalar`的集合。 +其为`UnicodeScalarView`类型的属性,`UnicodeScalarView`是`UnicodeScalar`类型的值的集合。 `UnicodeScalar`是21位的 Unicode 代码点。 每一个`UnicodeScalar`拥有一个`value`属性,可以返回对应的21位数值,用`UInt32`来表示: From c470ad343eb9f060edd1bdb1e49bf15510fdb8df Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 16:09:42 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index 283e810d..c3d3cd08 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -649,7 +649,7 @@ print("") 🐶
U+1F436 - UTF-16
Code Unit + Unicode Scalar
Code Unit 68 111 103 From 64d9b135018e40c38e66c7fe6c11eb76819be464 Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 16:22:00 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BD=B2=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/README.md | 1 + source/chapter2/03_Strings_and_Characters.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/source/README.md b/source/README.md index d64c9b44..25134dc4 100755 --- a/source/README.md +++ b/source/README.md @@ -71,5 +71,6 @@ Swift 2.0 参与者名单(按照章节顺序): - [ray16897188](https://github.com/ray16897188) - [wardenNScaiyi](https://github.com/wardenNScaiyi) - [miaosiqi](https://github.com/miaosiqi) +- [Realank](https://github.com/Realank) 最后,感谢[极客学院](http://wiki.jikexueyuan.com)提供的wiki系统,在国内访问起来速度很快,优化后的样式看起来也更舒服。 \ No newline at end of file diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index c3d3cd08..506d87a9 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -10,7 +10,7 @@ > 2.1 > 翻译:[DianQK](https://github.com/DianQK) -> 校对:[shanks](http://codebuild.me) +> 校对:[shanks](http://codebuild.me), [Realank](https://github.com/Realank) 本页包含内容: From 908b206f334327550eb886a0f9b6bfabe4f686d1 Mon Sep 17 00:00:00 2001 From: Realank Date: Thu, 14 Jan 2016 17:19:10 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 叹号后面应该有空格的 --- source/chapter2/03_Strings_and_Characters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/03_Strings_and_Characters.md b/source/chapter2/03_Strings_and_Characters.md index 506d87a9..ece7412b 100755 --- a/source/chapter2/03_Strings_and_Characters.md +++ b/source/chapter2/03_Strings_and_Characters.md @@ -353,7 +353,7 @@ greeting.endIndex.successor() // error for index in greeting.characters.indices { print("\(greeting[index]) ", terminator: "") } -// 打印输出 "G u t e n T a g !" +// 打印输出 "G u t e n T a g ! " ``` From 9dc335493ebfefb507de9ffadc08797f3f6cb91a Mon Sep 17 00:00:00 2001 From: Realank-Mac Date: Thu, 14 Jan 2016 20:03:11 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=9B=86=E5=90=88?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=AB=A0=E8=8A=82=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chapter2/04_Collection_Types.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/chapter2/04_Collection_Types.md b/source/chapter2/04_Collection_Types.md index fe4629dc..249e19da 100755 --- a/source/chapter2/04_Collection_Types.md +++ b/source/chapter2/04_Collection_Types.md @@ -223,7 +223,7 @@ firstItem = shoppingList[0] ```swift let apples = shoppingList.removeLast() // 数组的最后一项被移除了 -// shoppingList 现在只有5项,不包括 cheese +// shoppingList 现在只有5项,不包括 Apples // apples 常量的值现在等于 "Apples" 字符串 ``` @@ -460,7 +460,7 @@ oddDigits.exclusiveOr(singleDigitPrimeNumbers).sort() * 使用`isSubsetOf(_:)`方法来判断一个集合中的值是否也被包含在另外一个集合中。 * 使用`isSupersetOf(_:)`方法来判断一个集合中包含另一个集合中所有的值。 * 使用`isStrictSubsetOf(_:)`或者`isStrictSupersetOf(_:)`方法来判断一个集合是否是另外一个集合的子集合或者父集合并且两个集合并不相等。 -* 使用`isDisjointWith(_:)`方法来判断两个集合是否不含有相同的值。 +* 使用`isDisjointWith(_:)`方法来判断两个集合是否不含有相同的值(是否没有交集)。 ```swift let houseAnimals: Set = ["🐶", "🐱"] From d3e873f2b499e370a9e2bf480370721d1bcbfff6 Mon Sep 17 00:00:00 2001 From: Realank-Mac Date: Thu, 14 Jan 2016 20:38:12 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=97=85=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chapter2/05_Control_Flow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/05_Control_Flow.md b/source/chapter2/05_Control_Flow.md index b056ce89..e6658d3d 100755 --- a/source/chapter2/05_Control_Flow.md +++ b/source/chapter2/05_Control_Flow.md @@ -30,7 +30,7 @@ Swift 的`switch`语句比 C 语言中更加强大。在 C 语言中,如果某 ## For 循环 -Swift 提供两种`for`循环形式以来按照指定的次数多次执行一系列语句: +Swift 提供两种`for`循环形式来按照指定的次数执行一系列语句: * `for-in`循环对一个集合里面的每个元素执行一系列语句。 * for 循环,用来重复执行一系列语句直到达成特定条件达成,一般通过在每次循环完成后增加计数器的值来实现。 From 30638918c3e7772ab5512e84133eb5421e882a87 Mon Sep 17 00:00:00 2001 From: Realank-Mac Date: Fri, 15 Jan 2016 07:29:35 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chapter2/06_Functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/06_Functions.md b/source/chapter2/06_Functions.md index 13a8f1dc..d8a2be2e 100755 --- a/source/chapter2/06_Functions.md +++ b/source/chapter2/06_Functions.md @@ -24,7 +24,7 @@ Swift 统一的函数语法足够灵活,可以用来表示任何函数,包括从最简单的没有参数名字的 C 风格函数,到复杂的带局部和外部参数名的 Objective-C 风格函数。参数可以提供默认值,以简化函数调用。参数也可以既当做传入参数,也当做传出参数,也就是说,一旦函数执行结束,传入的参数值可以被修改。 -在 Swift 中,每个函数都有一种类型,包括函数的参数值类型和返回值类型。你可以把函数类型当做任何其他普通变量类型一样处理,这样就可以更简单地把函数当做别的函数的参数,也可以从其他函数中返回函数。函数的定义可以写在在其他函数定义中,这样可以在嵌套函数范围内实现功能封装。 +在 Swift 中,每个函数都有一种类型,包括函数的参数值类型和返回值类型。你可以把函数类型当做任何其他普通变量类型一样处理,这样就可以更简单地把函数当做别的函数的参数,也可以从其他函数中返回函数。函数的定义可以写在其他函数定义中,这样可以在嵌套函数范围内实现功能封装。 ## 函数的定义与调用(Defining and Calling Functions) From 4dcc7205a24497aeb9a36cc6bc4e285c5ddfe4b8 Mon Sep 17 00:00:00 2001 From: Realank Date: Fri, 15 Jan 2016 07:45:11 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E7=BB=95=E5=8F=A3?= =?UTF-8?q?=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这句话有点绕口,换一种表达 --- source/chapter2/06_Functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/06_Functions.md b/source/chapter2/06_Functions.md index d8a2be2e..40aa5551 100755 --- a/source/chapter2/06_Functions.md +++ b/source/chapter2/06_Functions.md @@ -55,7 +55,7 @@ print(sayHello("Brian")) 调用 `sayHello(_:)` 函数时,在圆括号中传给它一个 `String` 类型的实参,例如 `sayHello("Anna")`。因为这个函数返回一个 `String` 类型的值,`sayHello` 可以被包含在 `print(_:separator:terminator:)` 的调用中,用来输出这个函数的返回值,正如上面所示。 -在 `sayHello(_:)` 的函数体中,先定义了一个新的名为 `greeting` 的 `String` 常量,同时赋值了给 `personName` 的一个简单问候消息。然后用 `return` 关键字把这个问候返回出去。一旦 `return greeting` 被调用,该函数结束它的执行并返回 `greeting` 的当前值。 +在 `sayHello(_:)` 的函数体中,先定义了一个新的名为 `greeting` 的 `String` 常量,同时,把对 `personName` 的问候消息赋值给了 `greeting` 。然后用 `return` 关键字把这个问候返回出去。一旦 `return greeting` 被调用,该函数结束它的执行并返回 `greeting` 的当前值。 你可以用不同的输入值多次调用 `sayHello(_:)`。上面的例子展示的是用`"Anna"`和`"Brian"`调用的结果,该函数分别返回了不同的结果。 From 999d92438fd76d159b2c83d045da35abaf9cb752 Mon Sep 17 00:00:00 2001 From: Realank Date: Fri, 15 Jan 2016 07:52:45 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E8=BE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chapter2/06_Functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter2/06_Functions.md b/source/chapter2/06_Functions.md index 40aa5551..cb081456 100755 --- a/source/chapter2/06_Functions.md +++ b/source/chapter2/06_Functions.md @@ -92,7 +92,7 @@ print(sayHelloWorld()) 函数可以有多种输入参数,这些参数被包含在函数的括号之中,以逗号分隔。 -这个函数取得一个人的名字和是否被招呼作为输入,并对那个人返回适当的问候语: +这个函数用一个人名和是否已经打过招呼作为输入,并返回对这个人的适当问候语: ```swift func sayHello(personName: String, alreadyGreeted: Bool) -> String {