correct an mistake
This commit is contained in:
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<div class="book" data-level="2.6" data-basepath=".." data-revision="1402322595980">
|
||||
<div class="book" data-level="2.6" data-basepath=".." data-revision="1402322774243">
|
||||
<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>
|
||||
@ -587,7 +587,7 @@
|
||||
|
||||
<div class="page-inner">
|
||||
|
||||
<section class="normal" id="section-gitbook_95">
|
||||
<section class="normal" id="section-gitbook_154">
|
||||
|
||||
<h1 id="-functions-">函数(Functions)</h1>
|
||||
<p>本页包含内容:</p>
|
||||
@ -770,9 +770,8 @@
|
||||
return s1 + joiner + s2
|
||||
}
|
||||
</code></pre><p>在这个例子中,Swift自动为<code>joiner</code>提供了外部参数名。因此,当函数调用时,外部参数名必须使用,这样使得参数的用途变得清晰。</p>
|
||||
<pre><code> func join(s1: String, s2: String, joiner: String = " ") -> String {
|
||||
return s1 + joiner + s2
|
||||
}
|
||||
<pre><code> join("hello", "world", joiner: "-")
|
||||
// returns "hello-world"
|
||||
</code></pre><blockquote>
|
||||
<p>注意:
|
||||
你可以使用<code>下划线(_)</code>作为默认值参数的外部参数名,这样可以在调用时不用提供外部参数名。但是给带默认值的参数命名总是更加合适的。</p>
|
||||
|
||||
Reference in New Issue
Block a user