Swift 5.X——while
作者:互联网
1.while
import UIKit var a = 0 while (a<5) { print(a)//0,1,2,3,4 a+=1 }
2.repeat-while
就是其它语言中的do-while
import UIKit var a = 0 var b = true repeat{//先执行 print(a)//0,1,2,3,4,5 a+=1 if (a>5) { b=false } } while (b)//此时b=false,意味着不执行while()
标签:repeat,false,UIKit,while,var,import,Swift 来源: https://www.cnblogs.com/yangyh26/p/11822913.html