3-8 Patterns 更新完成

This commit is contained in:
Leo Zhou
2015-10-11 15:52:19 +08:00
parent 852fbbe628
commit b58f66e6c4

View File

@ -6,7 +6,8 @@
> 校对:[numbbbbb](https://github.com/numbbbbb), [stanzhai](https://github.com/stanzhai) > 校对:[numbbbbb](https://github.com/numbbbbb), [stanzhai](https://github.com/stanzhai)
> 2.0 > 2.0
> 翻译+校对:[ray16897188](https://github.com/ray16897188) > 翻译+校对:[ray16897188](https://github.com/ray16897188),
> [BridgeQ](https://github.com/WXGBridgeQ)
本页内容包括: 本页内容包括:
@ -132,7 +133,7 @@ let (a): Int = 2 // a: Int = 2
<a name="optional_pattern"></a> <a name="optional_pattern"></a>
## 可选模式Optional Pattern ## 可选模式Optional Pattern
可选模式与封装在一个`Optional(T)`或者一个`ExplicitlyUnwrappedOptional(T)`枚举中的`Some(T)`用例相匹配。可选模式由一个标识符模式和紧随其后的一个问号组成,在某些情况下表现为枚举用例模式。 可选模式与封装在一个`Optional(Wrapped)`或者一个`ExplicitlyUnwrappedOptional(Wrapped)`枚举中的`Some(Wrapped)`用例相匹配。可选模式由一个标识符模式和紧随其后的一个问号组成,在某些情况下表现为枚举用例模式。
由于可选模式是`optional``ImplicitlyUnwrappedOptional`枚举用例模式的语法糖syntactic sugar下面的2种写法是一样的 由于可选模式是`optional``ImplicitlyUnwrappedOptional`枚举用例模式的语法糖syntactic sugar下面的2种写法是一样的