make gitbook

This commit is contained in:
numbbbbb
2014-06-12 14:58:48 +08:00
parent b5c397af6e
commit ccca58aeb3
45 changed files with 219 additions and 210 deletions

View File

@ -21,8 +21,8 @@
<link rel="prev" href="../chapter2/04_Collection_Types.html" />
<meta property="og:title" content="控制流 | 这一次,让中国和世界同步">
<meta property="og:site_name" content="这一次,让中国和世界同步">
<meta property="og:title" content="控制流 | The Swift Programming Language 中文版">
<meta property="og:site_name" content="The Swift Programming Language 中文版">
<meta property="og:type" content="book">
<meta property="og:locale" content="en_US">
@ -46,7 +46,7 @@
<div class="book" data-level="2.5" data-basepath=".." data-revision="1402555449431">
<div class="book" data-level="2.5" data-basepath=".." data-revision="1402556298428">
<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>
@ -98,7 +98,7 @@
<!-- Title -->
<h1>
<i class="fa fa-spinner fa-spin"></i>
<a href="../" >这一次,让中国和世界同步</a>
<a href="../" >The Swift Programming Language 中文版</a>
</h1>
</div>
@ -587,7 +587,7 @@
<div class="page-inner">
<section class="normal" id="section-gitbook_17">
<section class="normal" id="section-gitbook_129">
<blockquote>
<p>翻译vclwei, coverxit, NicePiao</p>
@ -600,7 +600,7 @@
<li><a href="#for_loops">For 循环</a></li>
<li><a href="#while_loops">While 循环</a></li>
<li><a href="#conditional_statement">条件语句</a></li>
<li><a href="#control_transfer_statements">控制传递语句Control Transfer Statements</a></li>
<li><a href="#control_transfer_statements">控制转移语句Control Transfer Statements</a></li>
</ul>
<p>Swift提供了类似 C 语言的流程控制结构,包括可以多次执行任务的<code>for</code><code>while</code>循环,基于特定条件选择执行不同代码分支的<code>if</code><code>switch</code>语句,还有控制流程跳转到其他代码的<code>break</code><code>continue</code>语句。</p>
<p>除了 C 语言里面传统的for条件递增<code>for-condition-increment</code>循环Swift 还增加了<code>for-in</code>循环用来更简单地遍历数组array字典dictionary区间range字符串string和其他序列类型。</p>
@ -996,7 +996,7 @@ case let (x, y):
<p>这三个 case 都声明了常量<code>x</code><code>y</code>的占位符,用于临时获取元组<code>yetAnotherPoint</code>的两个值。这些常量被用作<code>where</code>语句的一部分,从而创建一个动态的过滤器(filter)。当且仅当<code>where</code>语句的条件为<code>true</code>时,匹配到的 case 分支才会被执行。</p>
<p>就像是值绑定中的例子,由于最后一个 case 分支匹配了余下所有可能的值,<code>switch</code>语句就已经完备了,因此不需要再书写默认分支。</p>
<p><a name="control_transfer_statements"></a></p>
<h2 id="-control-transfer-statements-">控制传递语句Control Transfer Statements</h2>
<h2 id="-control-transfer-statements-">控制转移语句Control Transfer Statements</h2>
<p>控制转移语句改变你代码的执行顺序通过它你可以实现代码的跳转。Swift有四种控制转移语句。</p>
<ul>
<li>continue</li>