next enum in swift

时间:2014-06-06 09:07:38   收藏:0   阅读:215

```cpp enum Iter: Int{ case s1=0, s2, s3, s4 mutating func next(){ if self == .s4 { self = .s1 return } self = Iter.fromRaw(self.toRaw()+1)! } }

var s = Iter.s1

for i in 1 .. 10 { println(s.toRaw()) s.next() } ```

博客园的编辑器支持好简陋

next enum in swift,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!