|
|||||
|
対象: While文(Swift)SwiftのWhile文は特別な機能等はなく、ごく普通の繰返しを書くことができる。
var count = 0
while count < 10 {
print("While loop count = \(count)")
// ++count
count += 1
}
Repeat-While文も用意されている。Swift 2.0でDo-While文はRepeat-While文に変更された。
var count = 0
//do {
repeat {
print("Repeat-While loop count = \(count)")
// ++count
count += 1
} while count < 10
(2015/01/23) () Swift 4.0対応。
Copyright© 2004-2019 モバイル開発系(K) All rights reserved.
[Home]
|
|||||