Ios/swift/制御とループ
提供: 初心者エンジニアの簡易メモ
if制御
if str == "hello" { } else { }
switch制御
switch str { case "hello": break; case "good": break; default: break; }
for_inループ
var names:[String] = ["taro", "jiro", "saburo"] for name in names { print(name) } // ディクショナリのループ var user = ["name": "taro", "birth": "2000-10-10"] for (key, val) in user { print( "key = \(key), val = \(val)" ) }