| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
352 バイト追加 、 2021年1月27日 (水) 14:58
==関数==
===定義===
<pre>
import Foundation
Good-bye Hiroto Yagi!!
</pre>
===inoutによる参照渡し===
<pre>
import Foundation
 
func funcIntou(n: inout Int, m: inout Int) {
let temp = n
n = m
m = temp
}
 
func test() {
var a = 111;
var b = 999;
print(a, b)
funcIntou(n:&a, m:&b)
print(a, b)
}
 
test()
</pre>
*実行結果
<pre>
$ swift func_inout.swift
111 999
999 111
</pre>
 
==[[SwiftUI]]==
*[[SwiftUI]]

案内メニュー