「Swift入門」戻り値ない関数を作成するサンプル

書式
func 関数名(引数名:データの型)
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
func testFunc(msg: String) {
print("出力結果メッセージ:\(msg)")
}
testFunc(msg: "study skill in")
testFunc(msg: "http://www.arkgame.com")
func testFunc(msg: String) { print("出力結果メッセージ:\(msg)") } testFunc(msg: "study skill in") testFunc(msg: "http://www.arkgame.com")
func testFunc(msg: String) {
    print("出力結果メッセージ:\(msg)")
}
testFunc(msg: "study skill in")
testFunc(msg: "http://www.arkgame.com")

実行結果
$ swift test11.swift
出力結果メッセージ:study skill in
出力結果メッセージ:http://www.arkgame.com

Swift

Posted by arkgame