LoginSignup
2
2

More than 5 years have passed since last update.

ズンドコキヨシ with Swift

Posted at

Swiftで書いてみた(Xcode7.2.1&Swift2.1)

import Foundation

enum ズンドコ:UInt32 { case ズン,ドコ }
let expected = [ズンドコ.ズン, .ズン, .ズン, .ズン, .ドコ]
var list:[ズンドコ] = []

while(list.suffix(5) != expected.suffix(5)) {
    let val = ズンドコ(rawValue: arc4random_uniform(2))!
    print(val)
    list.append(ズンドコ(rawValue: val.rawValue)!)
}
print("キ・ヨ・シ!")

実行例

ズン
ドコ
ドコ
ズン
ズン
ズン
ズン
ドコ
キ・ヨ・シ!

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2