apply the change
This commit is contained in:
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="1.2" data-basepath=".." data-revision="1401881908280">
|
||||
<div class="book" data-level="1.2" data-basepath=".." data-revision="1401890107706">
|
||||
<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>
|
||||
@ -218,7 +218,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_142">
|
||||
<section class="normal" id="section-gitbook_7">
|
||||
|
||||
<h1 id="swift-">Swift 初见</h1>
|
||||
<p>通常来说,编程语言教程中的第一个程序应该在屏幕上打印“Hello, world”。在 Swift 中,可以用一行代码实现:</p>
|
||||
@ -282,7 +282,7 @@ for score in individualScores {
|
||||
}
|
||||
}
|
||||
teamScore
|
||||
</code></pre><p>在<code>if</code>语句中,条件必须是一个布尔表达式——像<code>if score { ... }</code>这样的代码是错误的。</p>
|
||||
</code></pre><p>在<code>if</code>语句中,条件必须是一个布尔表达式——这意味着像<code>if score { ... }</code>这样的代码将报错,而不会隐形地与 0 做对比。</p>
|
||||
<p>你可以一起使用<code>if</code>和<code>let</code>来处理值缺失的情况。有些变量的值是可选的。一个可选的值可能是一个具体的值或者是<code>nil</code>,表示值缺失。在类型后面加一个问号来标记这个变量的值是可选的。</p>
|
||||
<pre><code>var optionalString: String? = "Hello"
|
||||
optionalString == nil
|
||||
|
||||
Reference in New Issue
Block a user