swift 学习笔记之循环

2016-01-08  本文已影响9人  维子Vanessa

1.for循环

for var i = 0; i < 10; i++
{
    print(i)
}
for i in 0...10
{
    print(i)
}

2.while循环

var num = 0
while num < 10
{
    print(num)
    num++
}

3.repeat while循环

var value = 0
repeat{
    print(value)
    value++
}while value < 10
上一篇下一篇

猜你喜欢

热点阅读