update 2 new article
This commit is contained in:
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.8" data-basepath=".." data-revision="1402287112409">
|
||||
<div class="book" data-level="2.8" data-basepath=".." data-revision="1402299637539">
|
||||
<div class="book-header">
|
||||
<!-- Actions Left -->
|
||||
<a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
|
||||
@ -178,7 +178,7 @@
|
||||
<li class="chapter " data-level="2.2" data-path="chapter2/02_Basic_Operators.html">
|
||||
|
||||
<a href="../chapter2/02_Basic_Operators.html">
|
||||
<i class="fa fa-check"></i> <b>2.2.</b> 基本操作符
|
||||
<i class="fa fa-check"></i> <b>2.2.</b> 基本运算符
|
||||
</a>
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@
|
||||
<li class="chapter " data-level="2.12" data-path="chapter2/12_Subscripts.html">
|
||||
|
||||
<a href="../chapter2/12_Subscripts.html">
|
||||
<i class="fa fa-check"></i> <b>2.12.</b> 下标
|
||||
<i class="fa fa-check"></i> <b>2.12.</b> 附属脚本
|
||||
</a>
|
||||
|
||||
|
||||
@ -520,7 +520,7 @@
|
||||
|
||||
<a href="../chapter2/11_Methods.html" title="方法" class="chapter done " data-progress="2.11" style="left: 18.42105263157895%;"></a>
|
||||
|
||||
<a href="../chapter2/12_Subscripts.html" title="下标" class="chapter done " data-progress="2.12" style="left: 21.05263157894737%;"></a>
|
||||
<a href="../chapter2/12_Subscripts.html" title="附属脚本" class="chapter done " data-progress="2.12" style="left: 21.05263157894737%;"></a>
|
||||
|
||||
<a href="../chapter2/13_Inheritance.html" title="继承" class="chapter done " data-progress="2.13" style="left: 23.68421052631579%;"></a>
|
||||
|
||||
@ -536,7 +536,7 @@
|
||||
|
||||
<a href="../chapter2/19_Nested_Types.html" title="嵌套类型" class="chapter done " data-progress="2.19" style="left: 39.473684210526315%;"></a>
|
||||
|
||||
<a href="../chapter2/02_Basic_Operators.html" title="基本操作符" class="chapter done " data-progress="2.2" style="left: 42.10526315789474%;"></a>
|
||||
<a href="../chapter2/02_Basic_Operators.html" title="基本运算符" class="chapter done " data-progress="2.2" style="left: 42.10526315789474%;"></a>
|
||||
|
||||
<a href="../chapter2/20_Extensions.html" title="扩展" class="chapter done " data-progress="2.20" style="left: 44.73684210526316%;"></a>
|
||||
|
||||
@ -587,7 +587,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_57">
|
||||
<section class="normal" id="section-gitbook_25">
|
||||
|
||||
<h1 id="-">枚举</h1>
|
||||
<p>本页内容包含:</p>
|
||||
@ -628,7 +628,7 @@
|
||||
</code></pre><p><code>directionToHead</code>的类型被推断当它被<code>CompassPoint</code>的一个可能值初始化。一旦<code>directionToHead</code>被声明为一个<code>CompassPoint</code>,你可以使用更短的点(.)语法将其设置为另一个<code>CompassPoint</code>的值:</p>
|
||||
<pre><code>directionToHead = .East
|
||||
</code></pre><p><code>directionToHead</code>的类型已知时,当设定它的值时,你可以不再写类型名。使用显示类型的枚举值可以让代码具有更好的可读性。</p>
|
||||
<h2 id="-switch-">用<code>Switch</code>语句匹配枚举值</h2>
|
||||
<h2 id="-switch-">匹配枚举值和<code>Switch</code>语句</h2>
|
||||
<p>你可以匹配单个枚举值和<code>switch</code>语句:</p>
|
||||
<pre><code>directionToHead = .South
|
||||
switch directionToHead {
|
||||
|
||||
Reference in New Issue
Block a user